Datasheet
Reviewing the Code
Now that you have created a simple Windows application, let ’ s review the elements of the code that have
been added by the IDE. Following is the entire Form1.Designer.vb source listing. Highlighted in this
listing are the lines of code that have changed since the original template was used to generate this project:
< Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated() > _
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
< System.Diagnostics.DebuggerNonUserCode() > _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
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()
Me.ButtonTest = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'ButtonTest
'
Me.ButtonTest.Location = New System.Drawing.Point(13, 13)
Me.ButtonTest.Name = "ButtonTest"
Me.ButtonTest.Size = New System.Drawing.Size(104, 23)
Me.ButtonTest.TabIndex = 0
Me.ButtonTest.Text = "Run Code"
Me.ButtonTest.UseVisualStyleBackColor = True
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(328, 258)
Me.Controls.Add(Me.ButtonTest)
Me.Name = "Form1"
Me.Text = "Professional VB.NET"
Me.ResumeLayout(False)
End Sub
Friend WithEvents ButtonTest As System.Windows.Forms.Button
End Class
Code snippet from Form1.Designer
After the class declaration in the generated fi le, the fi rst change made to the code is the addition of a new
variable to represent the new button:
Friend WithEvents ButtonTest As System.Windows.Forms.Button
Enhancing a Sample Application
❘
43
CH001.indd 43CH001.indd 43 4/5/10 11:56:55 AM4/5/10 11:56:55 AM