Hi,
I am getting a Exception has been thrown by the target of an invocation
error when invoking a method
Here is the crux of the code.
I realise it could be a few things, any one give me an idea where
to start looking.
rotsey
object obj;
Type type;
type = Type.GetType("TBR.NET." + formdef.TableName);
obj = Activator.CreateInstance(type);
if (obj == null)
throw new ApplicationException("Cannot create object for type " +
formdef.TableName);
int retval = (int)type.InvokeMember("Update",
BindingFlags.InvokeMethod,null, obj, null);
Alberto Poblacion - 27 Jun 2007 08:00 GMT
> I am getting a Exception has been thrown by the target of an invocation
> error when invoking a method
Typically this means that you succeeded in calling the method, but
something failed inside that method and threw an exception. Take a look at
the InnerException inside the Exception that you received to find out more
about what failed inside your method.
Jon Skeet [C# MVP] - 27 Jun 2007 08:06 GMT
On Jun 27, 7:36 am, "Rotsey"
<malcolm_sm...@RemoveThis.optusnet.com.au> wrote:
> I am getting a Exception has been thrown by the target of an invocation
> error when invoking a method
Obvious next question: what does the inner exception say? That should
make it a lot clearer what's going wrong.
Jon
Rotsey - 27 Jun 2007 08:28 GMT
of course. bit slow today soory
> On Jun 27, 7:36 am, "Rotsey"
> <malcolm_sm...@RemoveThis.optusnet.com.au> wrote:
[quoted text clipped - 5 lines]
>
> Jon