How can I get a form in a class library to become an MDI Child of the main
application? I've tried the following, but does not work:
Class Library...
public class Class1
{
public Class1()
{
//
// TODO: Add constructor logic here
//
}
public static bool
DisplayForm(System.Windows.Forms.Form theMDIParent)
{
Form1 f = new Form1();
f.MdiParent = theMDIParent;
f.ShowDialog();
f.Close();
return true;
}
}
In Main App...
Assembly asm = Assembly.LoadFile(@"c:\Documents and Settings\rvasquez\My
Documents\Visual Studio
Projects\TestMDIForms\OtherForms\bin\debug\OtherFo rms.dll");
Type t = asm.GetType("OtherForms.Class1");
object result = null;
object[] arguments = {this};
result = t.InvokeMember("DisplayForm",BindingFlags.InvokeMe thod, null,
result, arguments);