Parent and child forms

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
 
H

Herfried K. Wagner [MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top