Parent and child forms

  • Thread starter Thread starter Teo
  • Start date Start date
T

Teo

Hi!!
I created a form that I already set as IsMdiContainer to True.
How can I tell each new form I create to work under the container form
without having to declare the
aboutfsm.MdiParent = Me
login.MdiParent = Me
NEWPILOT.MdiParent = Me
to every single form I create.
Any suggestions?

Also, how can I tell my form to use the available space inside the container
form when opening?
I tried Maximized when setting the default form load but doesn't work.

Thanks much in advance.

Teo
 
Teo said:
I created a form that I already set as IsMdiContainer to True.
How can I tell each new form I create to work under the container form
without having to declare the
aboutfsm.MdiParent = Me
login.MdiParent = Me
NEWPILOT.MdiParent = Me
to every single form I create.
Any suggestions?

How many different form types do you have?! You could save some lines of
code by writing a procecure:

\\\
Public Sub ShowFormInContainer( _
ByVal ChildForm As Form _
)
ChildForm.MdiParent = Me
End Sub
....
ShowFormInContainer(New AboutForm())
ShowFormInContainer(New LoginForm())
....
///
Also, how can I tell my form to use the available space inside the
container form when opening?
I tried Maximized when setting the default form load but doesn't work.

Did you try to maximize the forms in the child forms' 'Load' event handlers
or in the 'Load' event handler of the MDI container?

If your child forms are always maximized, you may want get back to a normal
form as the main form which contains a tabcontrol whose pages host user
controls. Each child form can then be replaced by a user control.
 
Back
Top