Dim first As Double
Dim second As Double
Dim sign As String
Private Sub Command1_Click(Index As Integer)
If txtDisplay.Text = "" Then
txtDisplay.Text
= Command1(Index).Caption
Else
txtDisplay.Text
= txtDisplay.Text & Command1(Index).Caption
End If
End Sub
Private Sub Command2_Click(Index As Integer)
first = txtDisplay.Text
txtDisplay.Text = ""
sign = Command2(Index).Caption
End Sub
Private Sub Form_Load()
txtDisplay.Enabled = False
txtDisplay.MaxLength = 10
End Sub
Private Sub cmdEq_Click()
second = txtDisplay.Text
If sign = "-" Then
txtDisplay.Text
= first - second
ElseIf sign = "+" Then
txtDisplay.Text
= first + second
ElseIf sign = "*" Then
txtDisplay.Text
= first * second
ElseIf sign = "/" Then
txtDisplay.Text
= first / second
End If
End Sub
Private Sub cmdDot_Click()
If InStr(txtDisplay.Text, ".") = 0 Then
txtDisplay.Text = txtDisplay.Text & "."
End If
End Sub
Private Sub cmdClear_Click()
txtDisplay.Text = "0"
End Sub
Wednesday, June 23, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment