VB6 - Calculator

All tutorials created in VB6 to be posted in here.
1 post Page 1 of 1
Contributors
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

VB6 - Calculator
GoodGuy17
Hello,
I am going to show you how to make a calculator.
First, set your form up like this:
Image
Next, right click and click View Code
Then, copy and paste all of this in the text field for code:
Code: Select all
Private Sub Command1_Click()
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
End Sub

Private Sub Command2_Click()
Text3.Text = Val(Text1.Text) - Val(Text2.Text)
End Sub

Private Sub Command3_Click()
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
End Sub

Private Sub Command4_Click()
Text3.Text = Val(Text1.Text) / Val(Text2.Text)
End Sub

Private Sub Form_Load()
Text3.Locked = True
End Sub
Now run it and it should calculate just fine!
Enjoy!
~GoodGuy17~ :D
1 post Page 1 of 1
Return to “VB6 Tutorials”