Public curval As Double
Public preval As Double
Public choice As String
Public result As Double
Private Sub cmdac_Click()
curval = prevalue = 0
Text1.Text = ""
End Sub
Private Sub cmddiv_Click()
Text1.Text = ""
preval = curval
curval = 0
choice = "/"
End Sub
Private Sub cmdequal_Click()
Select Case choice
Case "+"
result = preval + curval
Text1.Text = Str(result)
Case "-"
result = preval - curval
Text1.Text = Str(result)
Case "*"
result = preval * curval
Text1.Text = Str(result)
Case "/"
If curval = 0 Then
MsgBox "Result is not defined"
Else
result = preval / curval
Text1.Text = Str(result)
End If
End Select
curval = result
End Sub
Private Sub cmdminus_Click()
Text1.Text = ""
preval = curval
curval = 0
choice = "-"
End Sub
Private Sub cmdmul_Click()
Text1.Text = ""
preval = curval
curval = 0
choice = "*"
End Sub
Private Sub cmdnegative_Click()
curval = -curval
Text1.Text = Str(curval)
End Sub
Private Sub cmdnos_Click(Index As Integer)
End Sub
Private Sub cmdplus_Click()
Text1.Text = ""
preval = curval
curval = 0
choice = "+"
End Sub
Private Sub Command1_Click(Index As Integer)
Text1.Text = Text1.Text & Command1(Index).Caption
curval = Val(Text1.Text)
End Sub
No comments:
Post a Comment
Note: only a member of this blog may post a comment.