遇到的问题,请教
vb吧
全部回复
仅看楼主
level 6
编写计算器
要求:
1,输入两个操作数和一个四则运算符
2.对输入的数据进行检验,出错时调用msgbox函数提示
2013年04月24日 09点04分 1
level 6
Private Sub Command1_Click()
Dim a
#, b#
, c#
a = Val(Text1.Text)
b = Val(Text2.Text)
if not isnumeric(text1) then
msgbox "输入有误"
elseif not isnumeric(text2) then
msgbox "输入有误"
elseIf Text3.Text = "+" Then
c = a + b
Text4.Text = c
ElseIf Text3.Text = "-" Then
c = a - b
Text4.Text = c
ElseIf Text3.Text = "*" Then
c = a * b
Text4.Text = c
ElseIf Text3.Text = "/" and len(text3.text)〈〉0 Then
c = a / b
Text4.Text = c
elseif Text3.Text = "/" and len(text3.text)=0 Then
msgbox "除数不能为零"
End If
End Sub
Private Sub Command2_Click()
End
End Sub
2013年04月24日 09点04分 3
level 6
2013年04月24日 09点04分 4
1