467,885 Members | 1,293 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,885 developers. It's quick & easy.

Problem invoking method with reflection

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);


Jun 27 '07 #1
  • viewed: 1443
Share:
3 Replies
"Rotsey" <ma***********@RemoveThis.optusnet.com.auwrote in message
news:eY**************@TK2MSFTNGP04.phx.gbl...
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.
Jun 27 '07 #2
On Jun 27, 7:36 am, "Rotsey"
<malcolm_sm...@RemoveThis.optusnet.com.auwrote:
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

Jun 27 '07 #3
of course. bit slow today soory

"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:11**********************@n2g2000hse.googlegro ups.com...
On Jun 27, 7:36 am, "Rotsey"
<malcolm_sm...@RemoveThis.optusnet.com.auwrote:
>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

Jun 27 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Nelson P. Varghese | last post: by
4 posts views Thread by Joanna Carter \(TeamB\) | last post: by
1 post views Thread by Beenish Sahar Khan | last post: by
3 posts views Thread by cartoper | last post: by
reply views Thread by =?Utf-8?B?TW9ydGVuIFdlbm5ldmlrIFtDIyBNVlBd?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.