PC Review


Reply
Thread Tools Rate Thread

Assembly.CreateInstance throws "Exception has been thrown by the target of an invocation."

 
 
cristian
Guest
Posts: n/a
 
      19th Nov 2004

I hope posting on this newsgroup is not such a big mistake, if so please
someone could redirect me to the right address?!

anyway, here is my problem,
On this line i receive an exception, that I wasn't able to find out where it
came from.

Assembly _formAssembly//just to show the type, it has been initialized
corectly

string _formClassName = path of the wanted assembly

Form frm = (Form)_formAssembly.CreateInstance_formClassName);

the inner exception has the message:"Object reference not set to an instance
of an object."

so far, I couldn't find which object is not an instance of an object.

has anyone a ideea of what is causing this?
thanks in advance!


 
Reply With Quote
 
 
 
 
cristian
Guest
Posts: n/a
 
      19th Nov 2004
I want to correct a typing error :

Form frm = (Form)_formAssembly.CreateInstance_formClassName);

Should have been

Form frm = (Form)_formAssembly.CreateInstance(_formClassName);

"cristian" <(E-Mail Removed)> wrote in message
news:<#(E-Mail Removed)>...

>


> I hope posting on this newsgroup is not such a big mistake, if so


> please someone could redirect me to the right address?!


>


> anyway, here is my problem,


> On this line i receive an exception, that I wasn't able to find out


> where it came from.


>


> Assembly _formAssembly//just to show the type, it has been initialized


> corectly


>


> string _formClassName = path of the wanted assembly


>


> Form frm = (Form)_formAssembly.CreateInstance_formClassName);


>


> the inner exception has the message:"Object reference not set to an


> instance of an object."


>


> so far, I couldn't find which object is not an instance of an object.


>


> has anyone a ideea of what is causing this?


> thanks in advance!


>


>



 
Reply With Quote
 
Richard Blewett [DevelopMentor]
Guest
Posts: n/a
 
      19th Nov 2004
You're absolutely sure that _formAssembly is non null?

if so, catch teh exception and psint out the stack trace to see which method is throwing the exception. It may be the form's constructor or InitializeComponent

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

I want to correct a typing error :

Form frm = (Form)_formAssembly.CreateInstance_formClassName);

Should have been

Form frm = (Form)_formAssembly.CreateInstance(_formClassName);

"cristian" <(E-Mail Removed)> wrote in message
news:<#(E-Mail Removed)>...

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ajax - "exception has been thrown by the target of an invocation" Monty Microsoft ASP .NET 2 21st Aug 2007 04:06 AM
"Exception has been thrown by the target of an invocation." =?Utf-8?B?RXVnZW5l?= Microsoft C# .NET 2 15th Jun 2006 06:03 PM
Exception has been thrown by the target of an invocation Brett Kelly Microsoft C# .NET 1 23rd Nov 2005 03:34 AM
Exception has been thrown by the target of an invocation raj via DotNetMonster.com Microsoft C# .NET 1 21st Mar 2005 06:05 AM
Exception has been thrown by the target of an invocation Jason MacKenzie Microsoft ADO .NET 2 17th Nov 2003 05:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:12 PM.