Webnode

VB Calculator

Hello, in this tutorial I'll teach you how to make a small calculator that will look like this:

(Example)

 

1. Open Visual studio 2010
2. Create a new visual basic windows form application project (.Netframework 3.5 or higher)
3. Call your project Calculator
4. Add 4 buttons, 3 textboxes (and maybe some labels), as you can see in the example picture above.
5. Change the text of your buttons to "+" , "-", "*", "/
6. Set the result-textbox propertie readonly to True:

This will make sure that the user cannot edit the result.

9. Double click the "+" button and add the following codes:

TextBox3.Text = (Integer.Parse(TextBox1.Text) + Integer.Parse(TextBox2.Text)).ToString()
 

10. Double click the '-' button and add the following codes:

TextBox3.Text = (Integer.Parse(TextBox1.Text) - Integer.Parse(TextBox2.Text)).ToString()

11. Double click the '*' button and add the following codes:

TextBox3.Text = (Integer.Parse(TextBox1.Text) * Integer.Parse(TextBox2.Text)).ToString()

12. Double click the '/' button and add the following codes:

TextBox3.Text = (Integer.Parse(TextBox1.Text) / Integer.Parse(TextBox2.Text)).ToString()

And now you made your very own calculator !

Download the source codes:

Calculator.rar (63,9 kB)


Topic: VB2010 Calculator

No comments found.