Load form with reflection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I try load a form with reflection :

Assembly myAssembly = Assembly.LoadFrom(dtr.GetString(0));
Form frmForm = myAssembly.CreateInstance("Nox.Grade") as Form;

but a NullReferenceException is generated.

If I use

Type type = Assembly.GetType("Nox.Grade")

it's Ok.

What is wrong ?
 
Are you checking to see if myAssembly is null? Is dtr null? What does the
stack trace tell you? On what line is the exception thrown?

- john
 
My form have a Datagrid. If I delete the DataGrid, the form load, but with
DataGrid the exception is showed.

myAssembly is null? no
Is dtr null? no
On what line is the exception thrown? in createinstance


Rogerio
 
Back
Top