cycledude
asked on
C#2010 winforms referencing the mdi parent form from a class
Hi
I have an application in which there is an mdiparent and lost of child forms.
I am trying to get a custom message form to appear in the parent from a class.. just to say 'please wait for process to complete'
so I created the form, and a reference to it:
form msg = new frmMessages()
now i need to tell the form that the mdiform is the parent, then display it .... this is where I am stuck
I have an application in which there is an mdiparent and lost of child forms.
I am trying to get a custom message form to appear in the parent from a class.. just to say 'please wait for process to complete'
so I created the form, and a reference to it:
form msg = new frmMessages()
now i need to tell the form that the mdiform is the parent, then display it .... this is where I am stuck
ASKER
Hi
I am referencing the forms from a class, so 'this' is referencing the class and not the mdiform.
I am referencing the forms from a class, so 'this' is referencing the class and not the mdiform.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
top man ;o)
You could also check the IsMdiContainer() property:
foreach(Form frm in Application.OpenForms)
{
if (frm.IsMdiContainer)
{
Form msg = new frmMessages();
msg.MdiParent = frm;
break;
}
}
childForm.MdiParent = this;
so the this.MdiParent in your child should give you what you want