Public nub As String
Private Sub Form_Load()
Call Random
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Val(Text1) > nub Then Label1.Caption = ("X < " & Text1)
If Val(Text1) < nub Then Label1.Caption = ("X > " & Text1)
If Val(Text1) = nub Then
Label1.Caption = ("X = " & Text1)
MsgBox ("bingo")
Call Random
End If
Text1.Text = ""
End If
End Sub
Function Random()
Randomize
nub = Int(Rnd * 99999)
Label1.Caption = ("X = ?")
End Function
is this code right??
if i want to to make the random number 1-100, how can i put the number into the code??
i am using vb 2008
thx a lot!
更新1:
my school said that should have 3 boxes , one from minimum one maximum and one of enter a number