Introduction to Controls in VB.NET
In this Article we demonstrate the basic concept of control,control class and how to use Controls
A control is a visual Basic object that can be placed on the form to Construct GUI(Graphical User Interface ). The standard objectToolBox contains all these objects that can be used in Constructing a GUI. Some examples of the Controls are Buttons,TextBoxes,Labels,Radio Buttons, etc.Control class works as a base class for all the Controls
Each Control contains two basic Features:
- Properties:- define particular characteristics of the object and
- Methods:-are the predefined procedures that are supplied with the object for performing specific tasks.
You can select the controls from ToolBox.You can find the properties of the control by selecting View and then Properties Windoow from the main menu.
Way to Create form with Controls
To create a Form select File then New then Project then Visual Basic Projects and select Windows Control Library from the templates and click OK.After that you can add user control to the existing project by selecting Project then Add User Control The image below displays the new project dialogue to add a User Control project.
The form will display after clicking OK and will look like the image below.

Now You Drag a Label and a TextBox control from the toolbox onto the form. The image below looks like.

Double-click the form to open it's code behind file. In the code behind file type the following code under End Sub of UserControl1 to set the property of the user control.
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Public Property sanText() As String
Get
sanText = TextBox1.Text
End Get
Set(ByVal Value As String)
TextBox1.Text = Value
End Set
End Property
Public Property sanLbl() As String
Get
sanLbl = Label1.Text
End Get
Set(ByVal Value As String)
Label1.Text = Value
End Set
End Property
End Class
Output:
