请参考如下完整代码:
Private Sub Command1_Click()
Randomize
a = Int(Rnd * 100)
Text1.Text = a
b = Int(Rnd * 100)
Text2.Text = b
Text3.Text = ""
Text3.SetFocus
'琐定光标
End Sub
Private Sub Command2_Click()
If (a + b) = Text3.Text Then
If (a + b) <> Text3.Text Then
Else
MsgBox "恭喜你,答对了!"
End If
Else
MsgBox "答案错误!"
End If
End Sub
Private Sub Command3_Click()
If Text3.Text = (a + b) Then GoTo 10
If Text3.Text <> (a + b) Then GoTo 16
Exit Sub
10:
MsgBox "恭喜你,答对了!"
Exit Sub ' 结束以上程序
16:
MsgBox "答案错误!"
End Sub