this is your project so, I wont give you the entire source, but for my calc program I did...
now for the operandCode:Private Sub cmd1_Click() If txtBox = "0" Then txtBox = 1 Else txtBox.Text = txtBox.Text & 1 End If End Sub
and for equalsCode:Private Sub cmdDivide_Click() Divide = txtBox txtBox = "" End Sub
txtBox is where you enter the numbers and stuffCode:Private Sub cmdEquals_Click() If Minus <> "" Then txtBox = Val(Minus) - Val(txtBox) ElseIf Plus <> "" Then txtBox = Val(Plus) + Val(txtBox) ElseIf Times <> "" Then txtBox = Val(Times) * Val(txtBox) ElseIf Divide <> "" Then txtBox = Val(Divide) / Val(txtBox) Else MsgBox "please push an operand(+,-,*, or /)", vbCritical, "Error" txtBox = "" End If End Sub
Plus
Minus
Divide
and
Times
are the vairables to store the first value of the operator....
after you click something like times, the textbox clears...




Reply With Quote