473,406 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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
3 1607
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ben Fidge | last post by:
Hi Is it possible, using Reflection, to determine at runtime the method(s) that are provided as handler for a given controls events? Also, once discovered, is it possible to manually invoke...
2
by: Nelson P. Varghese | last post by:
Please have a look at the code given below. The class named 'Class1' has two methods with the same name but with different case. Now how can I invoke these methods from VB. using System; ...
4
by: Joanna Carter \(TeamB\) | last post by:
I am trying to invoke an event using reflection. ////////////////////// public class Test { public event EventHandler NameChanged; public void CallEvent() {
1
by: Beenish Sahar Khan | last post by:
I'm using reflection to invoke some methods, now the general patteren of the function defination is private void FunctionName( argument1 , argument2) for some functions i don't need the...
2
by: Jeff | last post by:
I am trying to dynamically load an assembly via reflection and then invoke a method of that assembly that will populate a custom type collection passed into the method byref. I am able to...
3
by: cartoper | last post by:
I am currently doing some R&D. The objective is to learn how to invoke methods via reflection using the InvokeMember method. The InvokeMember method throws an exception: Method...
0
by: Shree | last post by:
While invoking the web service from client, I am setting the credentitals using the following code... ReportingService.Credentials = System.Net.CredentialCache.DefaultCredentials; But in...
0
by: iprogrammer | last post by:
i have a problem when i try to run my windows service ..which is "Error 1053: The service did not respond to the start or control request in a timely fashion" >after this i cannot anything with...
0
by: =?Utf-8?B?TW9ydGVuIFdlbm5ldmlrIFtDIyBNVlBd?= | last post by:
"Anders Borum" wrote: Hi Anders, I'm afraid the GetMethod() does not currently support filtering on generic parameters so you will have to loop through the existing methods using...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.