MDI Parent/Child forms

  • Thread starter Thread starter Linda U
  • Start date Start date
L

Linda U

This is what I have - Form1 is an MDI Container, form2 is an MDI Child
of form1, Form3 is a model form. What I want to be able to do is
activte form2 as a child of form1 from form3. The problem is that
form3 is not a child of form1 so I have no way of setting the mdiParent
property from form2. Does anyone know how to set the parent property
in this instance?
The other thing that would work is if you could have a model child
form, but .net doesn't seem to let you do this, or am I missing
something?

Thanks for your help,
Linda
 
Linda,

You are correct that an mdi child form cannot be shown modally.

Here is one way to accomplish what you need:

The form to be shown modally needs a reference to the mdi container. So in
form3 add a property to reference the container:

Public mdiContainer As Form1

On the mdi container form, write code to show form3 modally:

Dim f As New Form3
f.mdiContainer = Me

f.ShowDialog()

On form3, write code to show form2 as an mdi child form:

Dim f As New Form2
f.MdiParent = Me.mdiContainer
f.Show()

Me.Close()


Kerry Moorman
 
Back
Top