Windows Form in Visual Basic .NET

In this article, I will explain you about Windows Form in Visual Basic .NET.
  • 1976

 Windows Form

Windows Form is the cynosure of the Windows Application. In Visual Basic they are Forms on which we work. We build and develop our entire user interface on Windows Form. As we design and modify the user interface in our Windows Forms applications, we have to add controls. Forms allow us to work with controls and other items from the toolbox. Each type of control has its own set of properties, methods, and events that make it suitable for a particular purpose. In Visual Basic .NETSystem.Windows.Forms Namespace supports the forms and the form class isSystem.Windows.Forms.Form.

When we open a new project in Visual Basic the dialogue box looks like the image below. Since we are working with Windows Applications (Forms) you need to select Windows Application and click OK.

img1.gif
 

Once you click OK a new Form opens with the title, Form1, towards the top-left side of the form. The whole form is surrounded with a border. The main area in which we work is called the client area. We design our user interface in the client area leaving all the code to the code behind file. Forms also support events which lets the form know that something happened with the form.

img2.gif

Typically this is the code for creating Form which is handled by the Framework.

Public Class Form1
    Inherits System.Windows.Forms.Form
 
#Region " Windows Form Designer generated code "
     Public Sub New()
        MyBase.New()
        'This call is required by the Windows Form Designer.
        InitializeComponent()
        'Add any initialization after the InitializeComponent() call
 
    End Sub
 
    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is NothingThen
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
 
    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer
 
    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer. 
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(496, 493)
        Me.Name = "Form1"
        Me.Text = "Form1"
 
    End Sub
 
#End Region
 
    Private Sub Form1_Load(ByVal sender As System.ObjectByVal e As System.EventArgsHandlesMyBase.Load
 
    End 
Sub
End Class

Summary

I hope this article help you to understand about Windows Form in Visual Basic .NET.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.