controls in visual


There are many controls that can be added on the form. These include textbox, labels, buttons, combo box, rich text box etc Procedure 1 Ensure that the form is selected by clicking once on it, dots around the form shows that it is selected. Procedure 2 From the tool box double click the control you want added to the form. The control is automatically added to your form.You can position the control on the form by clicking once on it and dragging it to the position of your choice.


Create a new project

Name the project addition

Once the form loads change its text property in the properties window to addition

Locate a textbox on the toolbox and add it to the form.

NB. If the tool box is not shown you can access it by clicking view in the main menu then selecting toolbox.

Once you have added a textbox position it at the top center of the form.

Add also a button to the form and position it at the bottom center of the form.

Click on the button once to select it and change its text property in properties window to Equals. 0r “=” without the quotes.

Save the changes by clicking the file menu from the main menu and selecting save all.

This is what you are to come up with.



Everything you do in vb2010 is a project.

So with your project still open click on debug from the main menu and from the drop down menu click start debugging.The project will debug and run. Try typing something inside the textboxes on the form that appears while the program is running.




Our program is doing very little; Only displaying a form with textboxes and buttons on it.Variables are used to hold values. They are of different types and have to be declared.

The syntax is as follows.

Dim number1 As Integer.

Dim tells vb that we are declaring a variable.

Number1 is the name that we create for our variable.

As integer tells vb that our variable is of type integer.

Integer is type of a variable that holds whole number up to a certain value.Other variables include.Long integer Double String Etc



We are going to design a program that adds two numbers and displays them on the textbox


This is where the codes are written Accessing the code window Open the visual basic and open the project in exercise one.

With the form displayed double click on the button(with the text property equals) to display the code window as follows.

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


End Sub

End Class


Your code is supposed to go between the two spaces before the end sub.

Between the two lines above type the following text that is highlited in red


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim Answer As Integer

Answer = 50 + 100

TextBox1.Text = Answer

End Sub

End Class


your code window should look like this.


Now debug the project by selecting debug from the main menu, then from drop down menu that pops up click start debug.

Alternatively press f5 from the keyboard. Once your form is displayed click your “=” button’

true the answer of 50 + 100 is displayed. Congrats you have created your first program.