G
Guest
Okay, I have several Forms. I call a factory method which creates a new
thread, and in the threadstart I create a new Form (newForm) and call
"Application.Run(newForm)". This works fine. However, assigning the form to
the MDIParent causes a threading violation:
Form FindParent()
{ foreach (Form frm in Application.Forms)
if (frm.IsMdiContainer) return frm;
}
void AddClientForm( Form newForm)
{
Form frm = FindParent();
newForm.MDIParent = frm; // exception!
}
thread, and in the threadstart I create a new Form (newForm) and call
"Application.Run(newForm)". This works fine. However, assigning the form to
the MDIParent causes a threading violation:
Form FindParent()
{ foreach (Form frm in Application.Forms)
if (frm.IsMdiContainer) return frm;
}
void AddClientForm( Form newForm)
{
Form frm = FindParent();
newForm.MDIParent = frm; // exception!
}