Reputation: 3
I tried to create a new form inside the Parent. I set FormBorderStyle
to none
.
When I am adjusting MDIParent to the myForm
, it gave me a sick looking error like this:
System.ArgumentException : The given Form is not being recalled as a MdiContainer.
This is my code for creating a new Windows Form.
FrmHome myForm = new FrmHome ();
myForm.TopLevel = false;
pnlContainer.Controls.Add(myForm);
myForm.Show();
Upvotes: 0
Views: 147
Reputation: 5801
The Mdi parent must have it's IsMdiContainer
property set to True
.
You can set this property at design time in your main form or runtime :-
Form1 f1 = new Form1();
f1.MdiParent = this;
f1.Show();
Form1
is the name of the form that you want to show.
Form.IsMdiContainer Property
Property Value Boolean true if the form is a container for MDI child forms; otherwise, false. The default is false.
Upvotes: 2