Library tutorials & articles
Windows Forms and Controls
The Complete Form Class (ctd.)
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.
Related articles
Related discussion
-
How to write the category attribut in a class dynamically
by converter2009 (1 replies)
-
VB.NET: Hide and show table using radio buttons
by converter2009 (1 replies)
-
VB.Net Button Problem
by pysdex (0 replies)
-
Unable to access AxInterop.AcoPdflib.dll on 64 bit OS
by Shaila14041981 (0 replies)
-
Very Urgent regarding deleting the images from a folder
by Nanosteps (6 replies)
Related podcasts
-
xpert to Expert: Inside Concurrent Basic (CB)
"Concurrent Basic extends Visual Basic with stylish asynchronous concurrency constructs derived from the join calculus. Our design advances earlier MSRC work on Polyphonic C#, Comega and the Joins Library. Unlike its C# based predecessors, CB adopts a simple event-like syntax familiar to VB progr...
Only 5 years after the last post eh :) Anyway because things may have changed I recommend you look at the microsoft docs on this - http://msdn.microsoft.com/en-us/library/ms229597(VS.80).aspx
It may not work with mdi children.
I use VB.Net (framework 1.0.3705) on Windows 2000, and I noticed the 'MinimumSize' property doesn't seem to have any effect on my forms (MDIChildren). Does that property really prevent users from resizing a form to a smaller size than the MinimumSize? Any other experiences?
Thank you,
This thread is for discussions of Windows Forms and Controls.