下面是我练手时编的计算器的等号按钮事件,看能不能看清楚。
Private Sub Command14_Click()
d = ""
If Text1.Text = "+" Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Exit Sub
'c = Text1.Text
If b = "" Then Exit Sub
If e = "+" Then
d = f + b
Else
If e = "-" Then
d = f - b
Else
If e = "*" Then
d = f * b
Else
If e = "/" Then
If b = 0 Then
MsgBox "被除数不能为零!"
Exit Sub
End If
d = f / b
Else
MsgBox "错误操作!"
End If
End If
End If
End If
Text1.Text = d
b = ""
c = ""
e = ""
End Sub