This article will show you how to make a simple calculator using Visual Basic 6.0 or Visual Basic 8.0. This tutorial also supports Visual Basic 2008. So to start, just follow this simple steps:
1. In Visual Basic, make a new StandardEXE.
2. Put 3 Text Box in your form.
3. Put 4 Command Buttons in your form and change it's captions to MDAS.
4. This is the coding for Addition:
- Code:
-
Val(Text3.Text) = Val(Text1.Text) + Val(Text2.Text)
5. This is the coding for Subtraction:
- Code:
-
Val(Text3.Text) = Val(Text1.Text) - Val(Text2.Text)
6. This is the coding for Multiplication:
- Code:
-
Val(Text3.Text) = Val(Text1.Text) * Val(Text2.Text)
7. This is the coding for Division:
- Code:
-
Val(Text3.Text) = Val(Text1.Text) / Val(Text2.Text)
8. Congratulations! Now you can run your work.