473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Load form with reflection

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 ?
Nov 16 '05 #1
2 3731
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

Rogerio Jun <Ro********@discussions.microsoft.com> wrote:
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 ?


Nov 16 '05 #2
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

"co******@tetra.xionheights.net" wrote:
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

Rogerio Jun <Ro********@discussions.microsoft.com> wrote:
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 ?


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ed Sutton | last post by:
I have been searching for how to get an icon resource and load it into an ImageList. I added an *.ico file to my project and set the files "Build Action" to "Embedded Resource". Is there any easy...
1
by: TIM T | last post by:
I want to load a user control from a dll dynamically to my main form. I have been reading about using reflection. I got this to work with the methods from my other classes in the dll but I am not...
1
by: Greg Patrick | last post by:
My problem: I load an some assemblies (strong named) from a byte array using Assembly.Load(byte). They load fine. But one one of them is actually accessed, it's referenced assemblies can't be...
3
by: Eugene | last post by:
Consider a system that has exe and dlls, how can i ensure that only the authorized .net assembly can work with my system. For example, consider your sys got an exe, that would use dll A, B, and C;...
2
by: brianbender | last post by:
I am trying to load and unload assemblies dynamically and call methods and properties when loaded into an Appdomain I can load assemblies all day in the current AppDomain without references and...
2
by: Sascha | last post by:
Hi there, I searched carefully through the web before finally deciding to post this message, because I could not find a solution for my problem. Hopefully someone will have a hint or explanation...
0
by: Stefan Rosenthal | last post by:
Hi all, I've an OL-Style App loading MDIChild-Windows (Panes) on demand dynamicaly at runtime. Loading the Forms works fine but establishing an EventHandler (to receive information from the...
7
by: kendu | last post by:
Is it possible to dynamically load a form from file? This form is just a .vb file and has not been added to the project during design time. Ken
2
by: David Thielen | last post by:
So we have moved our app from .NET version 2.X in IIS6 to a Windows 2008 Server running IIS7. We have copied all files to the Windwardreports\apps directory and that apps directory has been...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.