Calculator

 

This is simple calculator created by my son, Liew Xun. This program uses a combo box which include four operators, addition, subtraction, multiplication and division. It can perform the above four basic calculations by changing the operators.

The Interface

 

 

 

 

 

 

 

 

 

 

The Codes (Copyright Liew Xun)

Private Sub Combo1_()

Select Case Combo1.ListIndex
Case 0
Label1 = Str$(Val(Text1.Text) + Val(Text2.Text))
Case 1
Label1 = Str$(Val(Text1.Text) - Val(Text2.Text))
End Select
End Sub







Private Sub Command1_Click()
Select Case Combo1.ListIndex
Case 0
Label1 = Str$(Val(Text1.Text) + Val(Text2.Text))
Case 1
Label1 = Str$(Val(Text1.Text) - Val(Text2.Text))
Case 2
Label1 = Str$(Val(Text1.Text) * Val(Text2.Text))
Case 3
Label1 = Str$(Val(Text1.Text) / Val(Text2.Text))

End Select
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
Combo1.AddItem "+"
Combo1.AddItem "-"
Combo1.AddItem "x"
Combo1.AddItem ""
Combo1.ListIndex = 1



End Sub

 

[Back to main page]