Design:
Fig-1:Object Arrangement |
Code:
Private Sub Form_Load()Label1.Caption = "Enter 1st Number"
Label2.Caption = "Enter 2nd Number"
Label3.Caption = ""
Label3.FontSize = 17
Label4.Caption = "Result:"
Text1.Text = ""
Text2.Text = ""
Option1.Caption = "ADD"
Option2.Caption = "SUB"
Option3.Caption = "MULT"
Option4.Caption = "DIV"
End Sub
Private Sub Option1_Click()
Label3.Caption = Val(Text1.Text) + Val(Text2.Text)
End Sub
Private Sub Option2_Click()
Label3.Caption = Val(Text1.Text) - Val(Text2.Text)
End Sub
Private Sub Option3_Click()
Label3.Caption = Val(Text1.Text) * Val(Text2.Text)
End Sub
Private Sub Option4_Click()
Label3.Caption = Val(Text1.Text) / Val(Text2.Text)
End Sub
Output:
Fig-2: First Output |
Fig-3: Second Output |
Related Videos:
Related VB 6 Example:
- VB 6.0 : Advance Calculator
- VB 6.0 : Scientific Calculator