帮忙,关于VB的

来源:百度知道 编辑:UC知道 时间:2024/06/13 19:08:39
Private Sub Command1_Click()
Dim a, b As Integer
Dim s As String
Randomize
a = Int(Rnd() * 100)
b = Int(Rnd() * 100)
s = CStr(a)
Label1.Caption = s
s = CStr(b)
Label2.Caption = s

End Sub

Private Sub Command2_Click()
Dim a, b, c As Integer
a = Int(Label1.Caption)
b = Int(Label2.Caption)
c = Int(Text1.Text)
If (a + b = c) Then
Label3.Caption = "正确"
Else
Label3.Caption = "错误"
End If

End Sub

Private Sub Command3_Click()
Label1.Caption = ""
Label2.Caption = ""
Label3.Caption = ""
Text1.Text = ""
End Sub

Private Sub Command4_Click()
End
End Sub

Private Sub Form_Load()
Label1.Caption = ""
Label2.Caption = ""
Text1.Text = ""
End Sub

Private Sub Label1_Click()

End Sub

Private Sub Command1_Click()
Dim a, b As Integer
Dim s As String
Randomize
a = Int(Rnd() * 100) /生成一个1到100之间的随机整数数
b = Int(Rnd() * 100) /生成一个1到100之间的随机整数数
s = CStr(a) /把a整数转换成字符s
Label1.Caption = s /label1显示s(即a)
s = CStr(b) /把b整数转换成字符s
Label2.Caption = s /label2显示s(即b)
End Sub

Private Sub Command2_Click()
Dim a, b, c As Integer
a = Int(Label1.Caption) /s转换为整型,和以上的a一样了
b = Int(Label2.Caption) /s转换为整型,和以上的b一样了
c = Int(Text1.Text) /把text1.text内容转换成整型,赋给c
If (a + b = c) Then 判断语句
Label3.Caption = "正确"
Else
Label3.Caption = "错误"
End If

End Sub

Private Sub Command3_Click() /清除所有内容
Label1.Caption = ""
Label2.Caption = ""
Label3.Caption = ""
Text1.Text = ""
End Sub

Private Sub Command4_Click() /退出功能
End
End Sub

Pri