c# reflection

February 20, 2010 at 20:52:49
Specs: Windows XP
I'm trying to use reflection open a mdi child. The catch is I'm using a helper class to do it.

The menu on the mdi parent passes the full child name to the helper class. I can get it to bring the form, just not as an mdi child. My mdi parent is set as an mdiparent.

//callimng helper class with child name
helper.openMDI("CPRG253.Act4.LarrySeymour.StudentForm");


public static void openMDI(string mdiName)
{
//Assembly myAssembly = Assembly.GetExecutingAssembly();
Type formType = Type.GetType(mdiName);
Form sf = System.Activator.CreateInstance(formType) as Form;
Form1 form1 = new Form1();

if (sf == null || sf.IsDisposed == true)
{
sf = new Form();
sf.MdiParent = form1;
}
sf.Show();
sf.BringToFront();
}


my checks all show false so it never creates the first one in the mdi container.

larry


See More: c# reflection

Report •

#1
February 20, 2010 at 21:34:11
not defined?
if ... || sf.IsDisposed == true)

Report •
Related Solutions


Ask Question