0% found this document useful (0 votes)
51 views1 page

Complete-Reference-Vb Net 84

Uploaded by

khalid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views1 page

Complete-Reference-Vb Net 84

Uploaded by

khalid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Automatically Generated Code

Note To support Windows XP visual styles, you can set the FlatStyle property of some of your visual
controls to System.

Automatically Generated Code

While you can easily construct a Windows application in code from scratch, as demonstrated in Chapter 9, it
is much easier and makes much more sense to let Visual Studio generate the initial application shell for you.

When you select Windows Application from the New Project dialog box, Visual Studio creates a solution (if
one is not open for the new application) and places your new project in it. This project contains various
references to core assemblies, namespaces, and so on, and one class, which is named Form1 by default.

Note To see the namespaces imported by default, open the Project Properties dialog box. To access
this, right−click the project in Solution Explorer, choose Properties, and then choose Imports
from the panel on the left side.

The default code generated when you create a form is as follows:

Public Class Form1


Inherits System.Windows.Forms.Form
Note The following code is contained within a region by default.
#Region " Windows Forms Designer generated code "
Public Sub New()
MyBase.New()
' This call is required by the Windows Forms 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 Forms Designer.


Private components As System.ComponentModel.Container

' NOTE: The following procedure is required by the Windows Forms Designer.
' It can be modified using the Windows Forms Designer.
' Do not modify it using the Code Editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
Me.Text = "Form1"
End Sub
#End Region

End Class

The InitializeComponent section is of interest to you because it is used by the IDE to hold the property
values that you visually set in the Windows Forms Designer. These properties persist in the application and
are required by the main form.

568

You might also like