Reputation: 5002
I have a form that this.IsMdiContainer = true
. I show a child form in it.
FrmCustomer frm=new FrmCustomer();
frm.MdiParent = this;
frm.Show();
I want to showdialog a form in FrmCustomer . I use this code,
FrmCustomerDetail frm=new FrmCustomerDetail(null);
frm.MdiParent = this.MdiParent;
frm.ShowDialog();
but i get error,
Form that is not a top-level form cannot be displayed as a modal dialog box. Remove the form from any parent form before calling showDialog.'
Upvotes: 0
Views: 320
Reputation: 18155
One way to do this would be to leave our the MdiOwner and set the Window Owner using ShowDialog method parameter.
FrmCustomerDetail frm=new FrmCustomerDetail(null);
frm.ShowDialog(this);
Upvotes: 1