By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,115 Members | 898 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,115 IT Pros & Developers. It's quick & easy.

Exception has been thrown by the target of an invocation

P: n/a
Hi,

I get the error, "Exception has been thrown by the target of an
invocation", at the last line of code.

Any idea why this happens and how to get it fixed?

Type mySFunction = Type.GetTypeFromProgID("S-
PLUS.rsi.em");

object splusObject =
Activator.CreateInstance(mySFunction);

object[] oArgs = new object[] { 33, 11, 56, 80 };

// Get error, "Exception has been thrown by the target
of an invocation"
splusObject.GetType().InvokeMember("x",
System.Reflection.BindingFlags.SetProperty, null, splusObject, oArgs);
Oct 29 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
There is no way for us to know what is wrong if we do not know what the
called function does. Can you link us to the API or control that you are
using, or at least describe the expected behavior?

In an essence, the error message means that the method you called raised an
exception. If in managed code, it could mean that the exception occurred in
the class contructor.

Hope this helps,
--
Stanimir Stoyanov
http://stoyanoff.info

"Curious" <fi********@yahoo.comwrote in message
news:93**********************************@m74g2000 hsh.googlegroups.com...
Hi,

I get the error, "Exception has been thrown by the target of an
invocation", at the last line of code.

Any idea why this happens and how to get it fixed?

Type mySFunction = Type.GetTypeFromProgID("S-
PLUS.rsi.em");

object splusObject =
Activator.CreateInstance(mySFunction);

object[] oArgs = new object[] { 33, 11, 56, 80 };

// Get error, "Exception has been thrown by the target
of an invocation"
splusObject.GetType().InvokeMember("x",
System.Reflection.BindingFlags.SetProperty, null, splusObject, oArgs);
Oct 30 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.