Private Sub Command1_Click()
Select Case Text2
Case "+"
Text4 = Val(Text1) + Val(Text3)
Case "-"
Text4 = Val(Text1) - Val(Text3)
Case "*"
Text4 = Val(Text1) * Val(Text3)
Case "/"
If Text3 <> 0 Then
Text4 = Val(Text1) / Val(Text3)
Else
MsgBox "被除数不能为0"
End If
Case Else
MsgBox "请在中间填入4则运算符+-*/"
End Select
End Sub
Private Sub Command1_Click()
a = InputBox("请输入第一个数")
b = InputBox("请输入运算符")
c = InputBox("请输入第二个数")
Select Case b
Case "+"
MsgBox Val(a) + Val(c)
Case "-"
MsgBox Val(a) - Val(c)
Case "*"
MsgBox Val(a) * Val(c)
Case "/"
MsgBox Val(a) / Val(c)
End Select
End Sub