473,563 Members | 2,767 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("T BR.NET." + formdef.TableNa me);

obj = Activator.Creat eInstance(type) ;

if (obj == null)

throw new ApplicationExce ption("Cannot create object for type " +
formdef.TableNa me);

int retval = (int)type.Invok eMember("Update ",
BindingFlags.In vokeMethod,null , obj, null);


Jun 27 '07 #1
3 1623
"Rotsey" <ma***********@ RemoveThis.optu snet.com.auwrot e in message
news:eY******** ******@TK2MSFTN GP04.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.optu snet.com.auwrot e:
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.co mwrote in message
news:11******** **************@ n2g2000hse.goog legroups.com...
On Jun 27, 7:36 am, "Rotsey"
<malcolm_sm...@ RemoveThis.optu snet.com.auwrot e:
>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
1671
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 these methods? For example, suppose I have a ImageButton on a webform that has an on click handler associated. I would like to be able to discover...
2
1697
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; namespace ClassLibrary1 { /// <summary> /// Summary description for Class1.
4
2579
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
2360
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 argument2 but for some i do...is there any way using reflection to invoke the method but omit the last argument in some function definations while for...
2
7758
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 dynamically load both the DALC component (for the method call) and the Entity component (for the custom type collection to pass in), but I keep getting an...
3
6553
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 'ReflectionTest.Originator.AddToA' not found. Here is the code: using System; using System.Diagnostics;
0
2184
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 debugger when I check the properties - 'domain', 'user name' and 'password' set in the ReportingService.Credentials; they are blank!!!
0
1559
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 the service and have to restart the computer inorder for the service to be deleted. >1) my service program is basically a client tht is listening on...
0
2340
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 GetMethods() MethodInfo methods = t.GetMethods();
0
7665
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7888
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7950
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6255
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.