Dim Op1, Op2 As Double
Dim Opr As String
Private Sub Command1_Click()
Text1.Text = Text1.Text + Command1.Caption
If cleardisplay Then
Text1.Text = ""
cleardisplay = False
End If
End Sub
Private Sub Command2_Click()
Text1.Text = Text1.Text + Command2.Caption
If cleardisplay Then
Text1.Text = ""
cleardisplay = False
End If
End Sub
Private Sub Command3_Click()
Text1.Text = Text1.Text + Command3.Caption
If cleardisplay Then
Text1.Text = ""
cleardisplay = False
End If
End Sub
Private Sub Command4_Click()
Text1.Text = Text1.Text + Command4.Caption
If cleardisplay Then
Text1.Text = ""
cleardisplay = False
End If
End Sub
Private Sub Command5_Click()
Text1.Text = Text1.Text + Command5.Caption
If cleardisplay Then
Text1.Text = ""
cleardisplay = False
End If
End Sub
Private Sub Command6_Click()
Text1.Text = Text1.Text + Command6.Caption
If cleardisplay Then
Text1.Text = ""
cleardisplay = False
End If
End Sub
Private Sub Command7_Click()
Text1.Text = Text1.Text + Command7.Caption
If cleardisplay Then
Text1.Text = ""
cleardisplay = False
End If
End Sub
Private Sub Command8_Click()
Text1.Text = Text1.Text + Command8.Caption
If cleardisplay Then
Text1.Text = ""
cleardisplay = False
End If
End Sub
Private Sub Command9_Click()
Text1.Text = Text1.Text + Command9.Caption
If cleardisplay Then
Text1.Text = ""
cleardisplay = False
End If
End Sub
Private Sub Command10_Click()
Text1.Text = Text1.Text + Command10.Caption
If cleardisplay Then
Text1.Text = ""
cleardisplay = False
End If
End Sub
Private Sub CommandDot_Click()
If InStr(Text1.Text, ".") Then
Exit Sub
Else
Text1.Text = Text1.Text + "."
End If
End Sub
Private Sub Commandcls_Click()
Text1.Text = ""
End Sub
Private Sub CommandPlus_Click()
Op1 = Val(Text1.Text)
Opr = "+"
Text1.Text = ""
End Sub
Private Sub CommandMinus_Click()
Op1 = Val(Text1.Text)
Opr = "-"
Text1.Text = ""
End Sub
Private Sub CommandMul_Click()
Op1 = Val(Text1.Text)
Opr = "*"
Text1.Text = ""
End Sub
Private Sub CommandDiv_Click()
Op1 = Val(Text1.Text)
Opr = "/"
Text1.Text = ""
End Sub
Private Sub CommandEqu_Click()
Op2 = Val(Text1.Text)
Select Case Opr
Case "+": Text1.Text = Op1 + Op2
Case "*": Text1.Text = Op1 * Op2
Case "-": Text1.Text = Op1 - Op2
Case "/": Text1.Text = Op1 / Op2
End Select
End Sub
Private Sub Commandexit_Click()
End
End Sub
Private Sub Form_Load()
Text1.Text = ""
End Sub
0 comments:
Post a Comment