- Home
·
- Math/Dates
·
- Create random numbers when a button is pushed and display those numbers in a text box
Create random numbers when a button is pushed and display those numbers in a text box
Create random numbers when a button is pushed and display those numbers in a text box
Rate Create random numbers when a button is pushed and display those numbers in a text box
(2(2 Vote))
Randomize
Dim 1 As Integer
1 = Int(Rnd(1) * 9) ' create random numbers between 1 and 9
Text1.Text = CStr(t1) ' display random number in text box
End Sub
'If you want to put different numbers in multiple text boxes
'use the sample code below
Randomize
Dim t1 As Integer
t1 = Int(Rnd(1) * 9)
Text2.Text = CStr(t1)
Dim t2 As Integer
t2 = Int(Rnd(1) * 9)
Text3.Text = CStr(t2)
Dim t3 As Integer
t3 = Int(Rnd(1) * 9)
Text4.Text = CStr(t3)
Dim t5 As Integer
t5 = Int(Rnd(1) * 9)
Text5.Text = CStr(t5)
Dim t6 As Integer
t6 = Int(Rnd(1) * 9)
Text6.Text = CStr(t6)
Dim t7 As Integer
t7 = Int(Rnd(1) * 9)
Text7.Text = CStr(t7)
'If you want all these numbers to appear in another text box use
'this code
Text8.Text = (Text1.Text) & (Text2.Text) & (Text3.Text) & (Text4.Text) & (Text5.Text) & (Text6.Text) & (Text7.Text)
End Sub
Create random numbers when a button is pushed and display those numbers in a text box Comments
No comments yet — be the first to post one!
Post a Comment