Visual Basic

Visual Basic Creating a simple Calculator to get familiar with the interface and code

  1. Once you have installed Visual Studio from https://www.visualstudio.com/downloads/, start a new project.

2.
3. Select ‘Windows Forms Application’ from Visual Basic Tab. You can rename it here if you need to.

4. Once you click ‘OK’, you will see this window:

  1. Click on the ‘Toolbox’ tab on the left. The toolbar has ‘auto-hide’ option enabled by default. To disable this option, click the small symbol between the ‘down arrow’ symbol and the ‘x’ symbol, on the top-right corner of Toolbox window.
  2. Get yourself familiar with the tools provided in the box. I have made a calculator interface by using buttons and a Textbox.

  1. Click on the Properties tab (It is on the right side of the editor). You can change the Text property of a button, and the textbox to rename them. Font property can be used to alter the font of the controls.
  2. To write the specific action for an event(eg. clicking on a button), double click on the control. Code window will open.
READ ALSO
How to backup archivelog for specific sequence RMAN

  1. VB.Net is a powerful language designed for fast development. High encapsulation and abstraction is cost for it. You do not need to add semicolon to indicate the end of a statement, there are no brackets, and most of the time, it auto-corrects the case of the alphabets.
  2. Code provided in the picture should be simple to understand. Dim is the keyword used to initialize a variable, and new allocates memory. Anything you type in the textbox is of type string by default. Casting is required to use the value as a different type.

Enjoy your first creation in VB.Net!