Now deep breath it’s time for the Constructor or the New procedure. This runs
when a new instance of the form is created. Public Sub New()
MyBase.New()
Me.cbCancel = New System.Windows.Forms.Button()
Me.cbAccept = New System.Windows.Forms.Button()
Me.txtEnteredText = New System.Windows.Forms.TextBox()
Me.lblEnterText = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'cbCancel
'
Me.cbCancel.Anchor = (System.Windows.Forms.AnchorStyles.Bottom
Or System.Windows.Forms.AnchorStyles.Right)
Me.cbCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.cbCancel.Location = New System.Drawing.Point(204,
108)
Me.cbCancel.Name = "cbCancel"
Me.cbCancel.TabIndex = 3
Me.cbCancel.Text = "Cancel"
'
'cbAccept
'
Me.cbAccept.Anchor = (System.Windows.Forms.AnchorStyles.Bottom
Or System.Windows.Forms.AnchorStyles.Right)
Me.cbAccept.Location = New System.Drawing.Point(112,
108)
Me.cbAccept.Name = "cbAccept"
Me.cbAccept.TabIndex = 2
Me.cbAccept.Text = "Accept"
'
'txtEnteredText
'
Me.txtEnteredText.Anchor = (System.Windows.Forms.AnchorStyles.Top
Or System.Windows.Forms.AnchorStyles.Right)
Me.txtEnteredText.Location = New System.Drawing.Point(132,
24)
Me.txtEnteredText.Name = "txtEnteredText"
Me.txtEnteredText.TabIndex = 1
Me.txtEnteredText.Text = "TextBox1"
'
'lblEnterText
'
Me.lblEnterText.Location = New System.Drawing.Point(20,
28)
Me.lblEnterText.Name = "lblEnterText"
Me.lblEnterText.Size = New System.Drawing.Size(100,
16)
Me.lblEnterText.TabIndex = 0
Me.lblEnterText.Text = "Enter Text:"
Me.lblEnterText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'frmMain
'
Me.AcceptButton = Me.cbAccept
Me.AutoScaleBaseSize = New System.Drawing.Size(6,
14)
Me.CancelButton = Me.cbCancel
Me.ClientSize = New System.Drawing.Size(292, 153)
Me.Controls.AddRange(New System.Windows.Forms.Control()
{Me.lblEnterText, Me.txtEnteredText, Me.cbAccept,
Me.cbCancel})
Me.Font = New System.Drawing.Font("Verdana", 8.25!,
System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.MinimumSize = New System.Drawing.Size(200, 100)
Me.Name = "frmMain"
Me.Text = "Forms and Controls"
Me.ResumeLayout(False)
End Sub
A lot of interesting code in there which sets the all the properties of the controls
to exactly what we set them to in the VS.Net designer. No other properties are
mentioned because they were left at the defaults.
Windows Forms and Controls
The Complete Form Class (ctd.)
You might also like...
About the author
Brian O'Connell
Microsoft Certified Applications Developer with 10 years experience developing web based applications using asp, asp.net for a Local Authority in Dublin. Clings to a firm belief that a web appli...
Interested in writing for us? Find out more.
VB.NET books
-
VB.NET for AutoCAD 2010 - Level 1
VB.NET can be used to customize AutoCAD with nearly unlimited power and flexibility. And for those who have been customizing AutoCAD with VBA, VB.NET is the logical language of choice once VBA is completely phased out of AutoCAD.This book is the edit...
VB.NET forum discussion
-
ICSharp ZIP library C# to VB.NET Port
by Garry Wang (6 replies)
-
Printing with formatting in VB.NET
by jclebon (7 replies)
-
IP2Location Geolocation .NET Component in VB.NET
by dunking (5 replies)
-
Watching Folder Activity in VB.NET
by emmaddai (17 replies)
-
print a document file without using print dialog control in Vb.net
by konikula (1 replies)
VB.NET podcasts
-
.NET Rocks: Eric Lippert Talks About Project Roslyn
Published 9 years ago, running time 0h56m
Recorded on PI day, Carl and Richard talk to the one-and-only Eric Lippert from the C# Compiler team. But we don't only talk about C#! The conversation wanders around all the languages, a little F#, a little IronPython, heck, even VB.NET! Eric talks about Project Roslyn, Microsoft's efforts to ma.
Comments