请大哥帮个忙。。。VB问题

来源:百度知道 编辑:UC知道 时间:2024/05/19 03:30:38
请问VB上msgbox函数怎么使用,还有帮忙做个题:一个加法出题程序,加法结果由用户输入,系统判断对错。。。谢谢!!!

'两个LABEL,1个TEXT,2个按钮

Private Sub Command1_Click() '随即出题,10以内的数
Randomize
Label1.Caption = Rnd() * 10 \ 1
Label2.Caption = Rnd() * 10 \ 1
End Sub

Private Sub Command2_Click() '判断结果
If Val(Label1.Caption) + Val(Label2.Caption) = Text1 Then
MsgBox "答对了", vbInformation, "提示"
Else
MsgBox "错!", vbCritical, "提示"
End If
End Sub

Private Sub Command1_Click()
MsgBox "消息框"
End Sub

a = InputBox("1+1=", "请回答:")
If a = 1 + 1 Then
MsgBox "答对了"
Else
MsgBox "答错了"
End If

MsgBox 函数 语言参考

描述
在对话框中显示消息,等待用户单击按钮,并返回一个值指示用户单击的按钮。
语法
MsgBox(prompt[, buttons][, title][, helpfile, context])
MsgBox 函数的语法有以下参数:

参数 描述
prompt 作为消息显示在对话框中的字符串表达式。prompt 的最