DotNetWebTutor.com                                                    Link to Us

Anchoring
Lets you hook a control to one of the form’s corners at a specific distance
Controls are anchored to top and left corner by default
When anchored, controls stay at a fixed distance from side they are bound to
anchoring in windows
Docking
Allows your control to bind to the edge of a form
You cannot dock and anchor same control
docking docking example
Click center of dock property gives it a fill value and it fills entire container
methods
Methods
Adding a form at runtime
Dim myForm as form2
myForm=new form2()
myForm.Show()

Open/Close Form
Show() method opens a form
Close() method closes a form
When you create a form, it will live until you call the close() method or end your application
events
Events

  • Activate
  • Deactivate
  • Load
    • Fires just before the load loads
  • Formclosing
    • Fires before the form closes
  • Formclosed    
    • Fires after the form closes

When using formclosing or formclosed you get back an eventargs that has a closereason property with one of these values

  • ApplicationExitCall
  • Formownerclosing
  • Midformclosing
  • Taskmanagerclosing
  • Userclosing
  • windowsshutdown

control collection
Controlscollection
Each form and container control has a controls collection
Contains list of all controls in that container
To add control to container at runtime:

Dim mybutton as new button
Mybutton.location=new point(50,50)
Mybutton.text=”Click me”
Panel1.controls.add(mybutton)
My.controls.add(mybutton)

end