03-31-2011, 17:53
Visual Basic Simple Calculator Tutorial
1.Open your Visual basic 2008/2010 and make new project called Calculator
2.Rename window to My First Calculator
3.Make 4 buttons with 20 size of text : 1 button : +, 2 button : - , 3 button : X , 4 Button : %
Picture :
4.Make 2 Text Boxes
Picture :
5.Now make 2 labels : 1 label let it be down in the middle with no text and second label in the middle of the 2 textboxes with no text too
Codingl
6.Double click on + button and type this :
Code:
Label2.Text = "+"
Label1.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
7.Double Click on The - button and type this :
Code:
Label2.Text = "-"
Label1.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
8.Double click on The X button and type this :
Code:
Label2.Text = "X"
Label1.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
9.Double Click on the % button and type this :
Code:
Label2.Text = "%"
Label1.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
10.Test it and congratz you maded your first calculator!
Picture :
Video :