标签:
Dim a As Double, b As Double
Dim c As String
Private Sub Command10_Click()
Text2.Text = Text2.Text & "2"
End Sub
Private Sub Command11_Click()
Text2.Text = Text2.Text & "3"
End Sub
Private Sub Command12_Click()
a = Text2.Text
Text2.Text = ""
c = "+"
End Sub
Private Sub Command13_Click()
Text2.Text = Text2.Text & "."
End Sub
Private Sub Command14_Click()
a = Text2.Text
Text2.Text = ""
c = "/"
End Sub
Private Sub Command15_Click()
a = Text2.Text
Text2.Text = ""
c = "*"
End Sub
Private Sub Command16_Click()
a = Text2.Text
Text2.Text = ""
c = "-"
End Sub
Private Sub Command18_Click()
Text2.Text = ""
End Sub
Private Sub Command19_Click()
b = Text2.Text
If a = "0" Or b = "0 " Then MsgBox "除数为可以为0", vbExclamation, "tips": Exit Sub
Select Case c
Case "+"
Text2.Text = Val(a) + Val(b)
Case "-"
Text2.Text = Val(a) - Val(b)
Case "*"
Text2.Text = Val(a) * Val(b)
Case "/"
Text2.Text = Val(a) / Val(b)
If Val(a) = 0 Then
MsgBox "除数不可以为:“0”"
Text2.Text = ""
End If
If Val(b) = 0 Then
MsgBox "除数不可以为:“0”"
Text2.Text = ""
End If
End Select
End Sub
Private Sub Command2_Click()
Text2.Text = Text2.Tex t & "6"
End Sub
Private Sub Command3_Click()
Text2.Text = Text2.Text & "5"
End Sub
Private Sub Command4_Click()
Text2.Text = Text2.Text & "4"
End Sub
Private Sub Command5_Click()
Text2.Text = Text2.Text & "9"
End Sub
Private Sub Command6_Click()
Text2.Text = Text2.Text & "8"
End Sub
Private Sub Command7_Click()
Text2.Text = Text2.Text & "7"
End Sub
Private Sub Command8_Click()
Text2.Text = Text2.Text & "0"
End Sub
Private Sub Command9_Click()
Text2.Text = Text2.Text & "1"
End Sub
标签:
原文地址:http://www.cnblogs.com/a369258147/p/4848916.html