MDI problem

  • Thread starter Thread starter Bevo
  • Start date Start date
B

Bevo

I use reflection to invoke a class derived from
System.Windows,Forms.Form and I want this form to run as
an MDIChild.

When I run it as a non-MDIChild the world smiles, when I
run it as a MDIChild its Show-method gives me this
exception:

'An unhandled exception of
type 'System.MissingMethodException' occurred in
mscorlib.dll

Additional information: No parameterless constructor
defined for this object.'

Has anyone experienced something like this? (the form
class has one constructor and it has no parameters)

Bevo
 
Bevo,

Can you give an example of how you are using Reflection to call the form
you want to use as an MDI child? Are you setting the IsMdiChild property on
the form to true before you add it to the MDI client?

Hope this helps.
 
Not really, but have you made sure you have set the MDIParent-property of
the child before calling Show();
 
Nicholas
My code goes like this (inside my MDIParent):

Assembly Host = Assembly.Load(<assemblyname>);
Form MyWindow = (Form)Host.CreateInstance(<classname>);
MyWindow.MdiParent = this;
MyWindow.Show();

No, I have not set the IsMDIChild property on MyWindow, it is a readonly
property as far as I can tell. Isnt the statement 'MyWindow.MdiParent =
this'
supposed to achieve the same relation?


Bevo
 
Nicholas
My code goes like this (inside my MDIParent):

Assembly Host = Assembly.Load(<assemblyname>);
Form MyWindow = (Form)Host.CreateInstance(<classname>);
MyWindow.MdiParent = this;
MyWindow.Show();

No, I have not set the IsMDIChild property on MyWindow,
it is a readonly property as far as I can tell. Isnt the
statement 'MyWindow.MdiParent = this'
supposed to achieve the same relation?


Bevo


-----Original Message-----
Bevo,

Can you give an example of how you are using Reflection to call the form
you want to use as an MDI child? Are you setting the IsMdiChild property on
the form to true before you add it to the MDI client?

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Bevo said:
I use reflection to invoke a class derived from
System.Windows,Forms.Form and I want this form to run as
an MDIChild.

When I run it as a non-MDIChild the world smiles, when I
run it as a MDIChild its Show-method gives me this
exception:

'An unhandled exception of
type 'System.MissingMethodException' occurred in
mscorlib.dll

Additional information: No parameterless constructor
defined for this object.'

Has anyone experienced something like this? (the form
class has one constructor and it has no parameters)

Bevo


.
 
Back
Top