呵呵,,~~不难这个东西,,弄来玩玩也可以
Dim k As Integer
Private Sub Command1_Click()
Randomize
Text2.Visible = False
Text2.Text = Int(Rnd * 90) + 10
Command1.Enabled = False
Command2.Enabled = True
End Sub
Private Sub Command2_Click()
Command1.Enabled = True
Command2.Enabled = False
Text3.Text = ""
End Sub
Private Sub Form_Load()
Command2.Enabled = False
k = 0
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 13
k = k + 1
Text3.Text = "你现在玩了" & k & "次"
Call pd
End Select
End Sub
Public Sub pd()
If Val(Text1.Text) > Val(Text2.Text) Then
MsgBox "你输入的数大了", vbOKOnly, "提示"
Text1.Text = ""
ElseIf Val(Text1.Text) < Val(Text2.Text) Then
MsgBox "你输入的数小了", vbOKOnly, "提示"
Text1.Text = ""
Else
MsgBox "恭喜你,答对了", vbOKOnly, "提示"
End If
End Sub
细节的你自己改,,不过没问题的,,我自己试过了~