Exception has been thrown by the target of an invocation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Curious

    Exception has been thrown by the target of an invocation

    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.GetTypeFro mProgID("S-
    PLUS.rsi.em");

    object splusObject =
    Activator.Creat eInstance(mySFu nction);

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

    // Get error, "Exception has been thrown by the target
    of an invocation"
    splusObject.Get Type().InvokeMe mber("x",
    System.Reflecti on.BindingFlags .SetProperty, null, splusObject, oArgs);
  • Stanimir Stoyanov

    #2
    Re: Exception has been thrown by the target of an invocation

    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


    "Curious" <fir5tsight@yah oo.comwrote in message
    news:93e89e5b-ed3b-4641-8c3a-a2da1cb1f0a8@m7 4g2000hsh.googl egroups.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.GetTypeFro mProgID("S-
    PLUS.rsi.em");
    >
    object splusObject =
    Activator.Creat eInstance(mySFu nction);
    >
    object[] oArgs = new object[] { 33, 11, 56, 80 };
    >
    // Get error, "Exception has been thrown by the target
    of an invocation"
    splusObject.Get Type().InvokeMe mber("x",
    System.Reflecti on.BindingFlags .SetProperty, null, splusObject, oArgs);

    Comment

    Working...