Calculator
Calculator
API Declarations
Dim Num1 As Integer, Num2 As Integer
Dim operator As String
Rate Calculator
(2(2 Vote))
txt_input.text = txt_input.text + "1"
End Sub
*NOTE: Repeat code for the rest of operands.
Private Sub cmd_add_click()
operator = "+"
Num1 = Val(txt_input.text)
End Sub
*NOTE: Repeat code for the rest of operators. You can modify the operator indicator if you desire according to the mathematical operator to be used.
Private Sub cmd_calculate_click()
if operator = "+" Then
Num2 = Val(txt_input.text)
txt_input = Num1 + Num2
End If
if operator = "-"
Num2 = Val(txt_input.text)
txt_input = Num1 - Num2
End If
if operator = "/"
Num2 = Val(txt_input.text)
txt_input = Num1 / Num2
End If
if operator = "*"
Num2 = Val(txt_input.text)
txt_input = Num1 * Num2
End if
End Sub
Calculator Comments
No comments yet — be the first to post one!
Post a Comment