Load form with reflection

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 ?
 
G

Guest

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top