Visual Basic Tutorial #1 | Calculator

How to make your own calculator​



What you are making:​
[​IMG]

Difficulty: Very easy
Time: 5-10 minutes​

Step 1:
Create a New Project -> Windows Forms Application

Step 2:
Create:

4 Buttons
2 Labels
2 Text Box

Step 3:
Rename the buttons to +, -, x, /
[​IMG]

Move the two text box's to the top
[​IMG]

Click the labels and remove the text saying Label.
You should have something looking like this.
[​IMG]
Do that to both, put one in-between the two Text box's and the other where you would like the answer to show.

Should look something like this.

[​IMG]

Step 4: Coding:
Double click the + button 
It should open up this.
[​IMG]

Add this code:

Code (Text):
 Label2.Text = "+"
Label1.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
Codes for other buttons

Step 5:
Check the error list:
[​IMG]

If there are 0 then you can go ahead and test it out.

Click the debug button. [​IMG]

Now try it out and you may need to move the labels so it looks good.

Then you are done!

[​IMG]

0 comments