What is Form Controls in VB.net?
A Form Controls In VB.net is used to build a form-based or window-based application.
We may create a visually appealing user interface using the form.
It functions as a container for a variety of controls that let a user interact with an application.
The controls take the form of an item, like buttons.
To carry out an operation, use Labels, Textboxes, Textarea, etc.
However, by making an instance of it, we can add any control to the runtime.
A VB.net Form Controls uses the System.Windows.Form namespace contains a large family of controls that may be added to a Window-based user interface to add both forms and functions.
In order for you to test your VB.net Code provided in this lesson, you must test the code in your code editor.
Form Properties in VB.net
The most significant list of form-related attributes is as follows.
Additionally, while the program is running, these attributes can be viewed or changed.
| Form Properties in VB.net | Description |
|---|---|
| BackColor | It is used to set the background color for the form. |
| BackgroundImage | It is used to set the background image of the form. |
| Cursor | It is used to set the cursor image when it hovers over the form. |
| AllowDrop | It is used to specify the localized language in a form. |
| Font | It is used to get or set the font used in a form. |
| Locked | It determines whether the form is locked or not. |
| FormBorderStyle | It is used to set or get border style in a form. |
| Text | It is used to set the title for a form window. |
| MinimizeBox | MinimizeBox It is used to display the minimum option on the title bar of the form. |
| IsMDIChild | It is used to authenticate whether a form is a container of a Multiple Document Interface (MDI) child form. |
| Autoscroll | It allows whether to enable auto-scrolling in a form. |
| MaximizeBox | It is used to display the maximum option on the title bar of the form. |
| MaximumSize | It is used to set the maximum height and width of the form. |
| Language | It is used to set the top-left corner coordinates of the form in pixels. |
| AcceptButton | It is used to set the form button if the enter key is pressed. |
| Top, Left | It is used to set the top-left corner coordinates of the form in pixel. |
| Name | It is used to define the name of the form. |
| MinimumSize | It is used to set the minimum height and width of the form. |
| Enabled | It uses the True or False value to enable mouse or keyboard events in the form. |
| TopMost | It uses a Boolean value that represents whether you want to put the window form on top of the other form. By default, it is False. |
Form Events in VB.net
The most significant list of form-related events is as follows.
| Form Events in VB.net | Description |
|---|---|
| Activated | An activated event is found when the user or program activates the form. |
| Click | A click event is active when the form is clicked. |
| Closed | A closed event is found before closing the form. |
| Closing | It exists when a form is closing. |
| DoubleClick | A DragDrop event is activated when a drag-and-drop operation is performed. |
| DragDrop | It is activated when a user clicks on the help button. |
| MouseDown | A MouseDown event is activated when the mouse pointer is on the form, and the mouse button is pressed. |
| GotFocus | A GotFocus event is activated when the form control receives a focus. |
| HelpButtonClicked | It is activated when a user clicked on the help button. |
| KeyDown | A KeyDown event is activated when a key is pressed while focussing on the form. |
| KeyUp | A KeyUp event is activated when a key is released while focusing on the form. |
| Load | The load event is used to load a form before it is first displayed. |
| LostFocus | It is activated when the form loses focus. |
| MouseEnter | A MouseEnter event is activated when the mouse pointer enters the form. |
| MouseHover | A MouseHover event is activated when the mouse pointer is put on the form. |
| MouseLeave | A MouseLeave event is activated when the mouse pointer leaves the form surface. |
| Shown | It is activated whenever the form is displayed for the first time. |
| Scroll | A Scroll event is activated when a form is scrolled through a user or code. |
| Resize | A Resize event is activated when a form is resized. |
| Move | A Move event is activated when a form is moved. |
Difference Between Form and Panel Control in VB.net
A Form in VB.net is a control and a container for other controls.
A Form Control in VB.net is the base unit of a Windows application. A Panel in VB.net is a control and a container for other controls.
Steps on How To Create a Windows Forms Application in VB.net
For creating a Windows Forms Application in VB.net make sure that you have already installed the Microsoft Visual Studio.
Time needed: 5 minutes
How To Create a Windows Forms Application in VB.net
- Step 1: Go to File Menu.
First, Open Microsoft Visual Studio and Click “File” Menu.

- Step 2: Click on New Project.
Next, Click the new Project.

- Step 3: Click on Windows Forms.
Next, Click on Windows Forms App or Application.

Now create a simple program of Windows form control in VB.NET.
Example Program in Creating Windows Form Application in VB.net:
Public Class Form1
Dim nameStr As String
Dim address As String
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
nameStr = TextBox1.Text
address = TextBox2.Text
Label3.Text = "You have entered the Name: " & nameStr + " and Address: " & address
End Sub
End Class
Now Enter the following details in the form.
After filling in all the details, click on the Submit button. After that, it shows the following Output:
Summary
In this tutorial we’ve discussed a step-by-step process on How To Create a Windows Forms Application in VB.net, this tutorial provides a runnable example program for free.
PREVIOUS
NEXT
Common use cases for Form Controls
Form Controls shows up frequently in production VB.NET codebases. The most common patterns:
- Business logic layer. Encapsulate rules and workflows separate from the UI.
- Data access patterns. Bridge between UI events and database operations cleanly.
- Utility helpers. Reusable methods for string processing, date arithmetic, or format conversion.
- Integration with .NET libraries. Interoperate with System.IO, System.Net, System.Text.RegularExpressions, and more.
- Legacy migration. Modernize VB6 code by wrapping old logic in idiomatic VB.NET constructs.
Working code example
Public Module Program
Public Sub Main(args As String())
' Practical demonstration of Form Controls
Dim result As String = ProcessData("sample input")
Console.WriteLine("Result: " & result)
Console.ReadKey()
End Sub
Private Function ProcessData(input As String) As String
If String.IsNullOrWhiteSpace(input) Then
Return "empty"
End If
Return input.ToUpper()
End Function
End Module
Best practices when working with Form Controls
- Explicit typing. Enable Option Strict On at the project level to force compile-time type checking.
- Namespace hygiene. Group related types under project-specific namespaces to avoid conflicts with .NET Framework types.
- Consistent naming. Follow Microsoft’s VB.NET style guide: PascalCase for public members, camelCase for locals.
- Error handling with Try/Catch. Prefer specific exception types over catch-all Exception blocks.
- Modern language features. Use string interpolation, LINQ, and Async/Await where they clarify intent.
Common pitfalls
- Late binding. Without Option Strict, VB.NET falls back to late-binding, hiding bugs until runtime.
- Nothing vs empty string. String.IsNullOrEmpty and String.IsNullOrWhiteSpace catch both cases; avoid checking IsNothing alone.
- Integer overflow. Use Long or Decimal for arithmetic that may exceed Int32.MaxValue.
- Date parsing across cultures. Always pass CultureInfo.InvariantCulture when serializing dates for storage.









