In Visual Basic its these Forms with which we work. They are the base on which we build, develop all our user interface and they come with a rich set of classes. Forms allow us to work visually with controls and other items from the toolbox. In VB .NET forms are based on the System.Windows.Forms namespace and the form class is System.Windows.Forms.Form. The form class is based on the Control class which allows it to share many properties and methods with other controls.
When we open a new project in Visual Basic the dialogue box that appears first is the one which looks like the image below. Since we are working with Windows Applications (Forms) you need to select WindowsApplication and click OK.
Once you click OK a new Form opens with the title, Form1, towards the top-left side of the form and maximize, minimize and close buttons towards the top right of the form. The whole form is surrounded with a border. The main area of the form in which we work is called the Client Area. It's in this client area we design the user interface leaving all the code to the code behind file. Forms also support events which let's the form know that something happened with the form, for example, when we double-click on the form, the Form load event occurs. VB .NET also supports forms to be inherited.
Image of a Windows Form.
Typically the Form looks like this in Code 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 Nothing) Then
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.
'
'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.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
from : http://www.startvbdotnet.com/forms/default.aspx
Windows Forms
Posted by CB Blogger
|
Social Media Widget SM Widgets
Demo Blog NJW V2 Updated at: 4:45 AM
0 komentar:
Post a Comment