So this tutorial is on creating a simple calculator in visual basic which performs the most basic arithmetic function like addition,subtraction,multiplication & division.
Lets start with creating a new project in visual basic choose windows form application and name your project whatever you want.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaZVvjNU2l_3yxgFO_Wn1aNdpyqsEB4MBo6edqgwC-bI7hrVplb2-_esIPzS1VKvOTiWBt8PcHU101KTK-rmRmWv9U67STTKgRAQG8FC-c2MM_wGj1cuMeyQg4LgYH0EJfZp9LkspNhuU/s320/1413695591099.png)
Designing the GUI of Calculator:
Add 17 buttons and a textbox.
Now change the text of buttons as specified below :
Button1 - 1
Button2 - 2
Button3 - 3
Button4 - 4
Button5 - 5
Button6 - 6
Button7 - 7
Button8 - 8
Button9 - 9
Button10 - 0
Button11 - .
Button12 - C
Button13 - +
Button14 - -
Button15 - X
Button16 - /
Button17 - =
Double click your form to switch to code view, clear all the code & paste the below code:
Now run your project and your most basic calculator is ready to perform basic calculations.
If you like the tutorial, Then do share :)
0 replies:
Post a Comment