|
-
Dec 2nd, 2002, 04:51 PM
#1
Thread Starter
Hyperactive Member
printing numbers in ascending order (in a string)
Hi,
My code below choses 10 numbers from 1 to 10 (same number not repeated twice).
The numbers are then listed in my picturebox, but I need to sort them in ASCENDING ORDER.
Any idea how I can do this?
Thanks for any help!
Public First As Integer, Second As Integer, Third As Integer, _
Fourth As Integer, Fifth As Integer, Sixth As Integer, _
Seventh As Integer, Eigth As Integer, Ninth As Integer, _
Tenth As Integer
Private Sub Command1_Click()
Dim Numbers As New Collection, a As Integer
Dim result As New Collection, temp As String
Randomize
Randomize
For a = 1 To 10
Numbers.Add a
Next a
Do While Numbers.Count
a = Int(Rnd * Numbers.Count) + 1
result.Add Numbers(a)
Numbers.Remove a
Loop
First = result(1)
Second = result(2)
Third = result(3)
Fourth = result(4)
Fifth = result(5)
Sixth = result(6)
Seventh = result(7)
Eigth = result(8)
Ninth = result(9)
Tenth = result(10)
Picture1.Cls
Picture1.Print First & " " & Second & " " & Third & " " & _
Fourth & " " & Fifth & " " & Sixth & " " & _
" " & Seventh & " " & Eigth & " " & Ninth & " " & Tenth
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|