Managing Forms
Position Forms
Properties –
Start position options
, 
For Manual
Enter the pixel location from the upper right
corner of the screen for the location of the upper left corner of the
form.
X is
over
Y is
down

Specify the Startup Object
Once you have multiple forms, you have to say
which the project should open with.


Create a Form at Run Time (Using Code)
This would be useful for pop-up messages.
Dim form2 as New Form
Form2.text = “New Form”
Form2.FormBorderStyle =
FormBorderStyle.FixedDialog
Form2StartPosition =
FormStartPosition.CenterScreen
Form2.ShowDialog()
Add Controls at Run Time (Using Code)
‘Declare the form and it’s control objects
Dim form2 As New Form
Dim btnCancel As New Button
Dim lblMsg As New Label
'put text on
the title bar
form2.Text = "Code Created Window"
‘position
the form
form2.StartPosition
= FormStartPosition.CenterScreen
'add a label
lblMsg.Text
= "Hello Programmer"
lblMsg.Size = New Size(150, 50)
lblMsg.Location = New Point(80, 50)
'add a
button to close the window
form2.CancelButton = btnCancel
form2.Controls.Add(btnCancel)
btnCancel.Text = "Close"
btnCancel.Location = New Point(110, 100)
'add the
objects to the form
form2.Controls.Add(lblMsg)
'open the
form
form2.ShowDialog()
|