- Home
·
- Math/Dates
·
- Create a user specified number of random numbers and put them in a list box.
Create a user specified number of random numbers and put them in a list box.
Create a user specified number of random numbers and put them in a list box.
Rate Create a user specified number of random numbers and put them in a list box.
(2(2 Vote))
'Create a Text box called Text1
'Create a List box called List1
'Create a Text box called create (this is the box that the users puts
'the number of random numbers they want generated)
Private Sub Generate_Click()
' This code creates a random number between 1 and 9
' It will keep creating random numbers until the
' number of numbers in the list is equal to the
' number specified in the create.Text box
' The random number will be shoved into Text1.Text
' When Text1.Text changes, the value of Text1.Text is
' added to the list
Do
Randomize
Dim t1 As Integer
t1 = Int(Rnd(1) * 9)
Text1.Text = CStr(t1)
Loop Until List1.ListCount = create.Text
End Sub
Private Sub Text1_Change()
List1.AddItem Text1.Text
End Sub
Create a user specified number of random numbers and put them in a list box. Comments
No comments yet — be the first to post one!
Post a Comment