MDI Forms - Children Calling Children of Parent

C

combo cas

Hello,

I have an error message when trying to call a child form from a Mdi
child form. I am trying to keep all forms within the same mdiParent
form.

I get the error:

An unhandled exception of type 'System.ArgumentException' occurred in
system.windows.forms.dll

Additional information: The form that was specified to be the MdiParent
for this form is not an MdiContainer.


this is at line:
frmLookupby.GlobalForm.MdiParent = Me.GlobalForm


I used Ngo Son Duong code in each of my forms. Form1 was the MdiParent.
Form2 was the mdichild and frmLookupby was to be the grandchild form.

#Region " Global Form "
'Copy this Region on every Form you wish to be accessed globally
'Just rename the Form1 to the name of your Form
Private Shared m_GlobalForm As Form1
Public Shared Property GlobalForm() As Form1
Get
If m_GlobalForm Is Nothing OrElse m_GlobalForm.IsDisposed
Then
m_GlobalForm = New Form1()
End If
Return m_GlobalForm
End Get
Set(ByVal Value As Form1 )
m_GlobalForm = Value
End Set
End Property
#End Region



Anyone have an idea what I am doing wrong?
 
M

Maqsood Ahmed

Hello,
you should first check that if the GlobalForm is the MdiContainer or
not.

First you should check this:
if Me.GlobalForm.IsMdiContainer
frmLookupby.GlobalForm.MdiParent = Me.GlobalForm

secondly... if you want a form to contain more forms in it then you
should set its IsMdiContainer property to true.

HTH.
Maqsood Ahmed [MCP,C#]
Kolachi Advanced Technologies
http://www.kolachi.net
 
C

combo cas

Hello,
Thanks for replying...

I tried to set the isMdicontainer to True for the Mdi Child and got the
error message " An unhandled exception of type
'System.ArgumentException' occurred in microsoft.visualbasic.dll

Additional information: A form can't be both an MDI child and MDI
parent.".
 

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