简易计算器
Private Sub Command1_Click()Dim a, b, result As Double
a = Text2.Text
b = Text3.Text
result = a + b
Text1 = result
End Sub
Private Sub Command2_Click()
Dim a, b, result As Double
a = Text2.Text
b = Text3.Text
result = a - b
Text1 = result
End Sub
Private Sub Command3_Click()
Dim a, b, result As Double
a = Text2.Text
b = Text3.Text
result = 0
If b <> 0 Then
result = a * b
Else
MsgBox "乘数不能为零"
End If
Text1 = result
End Sub
Private Sub Command4_Click()
Dim a, b, result As Double
a = Text2.Text
b = Text3.Text
result = 0
If b <> 0 Then
result = a / b
Else
MsgBox "除数不能为零"
End If
Text1 = result
End Sub