473,480 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

CreateDelegate error

Max
Hello,

I'm using late binding to automate to multiple versions of MS Outlook and I'm getting an ArgumentException when I create a delegate.

System.ArgumentException: Error binding to target method.
at System.Delegate.InternalCreate(Object target, String method, Boolean ignoreCase)
at System.Delegate.CreateDelegate(Type type, Object target, String method)

and it happens on the last line of this code:

Expand|Select|Wrap|Line Numbers
  1. Type oType = Type.GetTypeFromProgID("Outlook.Application");
  2. oApp = Activator.CreateInstance(oType);
  3.  
  4. oInspectors = oApp.GetType().GetProperty("Inspectors").GetValue(oApp, null);
  5.  
  6. e_NewInspector = oInspectors.GetType().GetEvent("NewInspector");
  7. d_NewEventDelegate = Delegate.CreateDelegate(e_NewInspector.EventHandlerType,
  8. this, "Inspectors_NewInspector");
  9.  
The class that is supposed to handle the event is defined as follows:

Expand|Select|Wrap|Line Numbers
  1. private void Inspectors_NewInspector(object insp, System.IntPtr param){ .... }
  2.  
The debugger loads the assemblies from the GAC:
Loaded 'c:\windows\assembly\gac\microsoft.office.interop. outlook\11.0.0.0__71e9bce111e9429c\microsoft.offic e.interop.outlook.dll',
No symbols loaded.
Loaded 'c:\windows\assembly\gac\office\11.0.0.0__71e9bce1 11e9429c\office.dll', No symbols loaded.

Can someone tell me what I'm doing wrong?

Oct 13 '05 #1
0 1108

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
6568
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
0
1026
by: Nivek Eroom | last post by:
Can anyone tells me how can i add a delegate to an object remotly created as this : object patate = Activator.GetObject(tt,"http://localhost:8080/DynamicTemplateServer.soap"); ...
1
267
by: redhotsly | last post by:
Hi, Is is possible to create an event handler method that can handle any type of event no matter what the delegate signature is. Here is the code I have so far: public class class1 {...
7
5975
by: Max | last post by:
I'm using late binding to automate to Outlook and I'm getting an ArgumentException when I create a delegate. The arguments I pass seem valid. This is my code: Type oType =...
7
4975
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
1
1630
by: snibril | last post by:
Hi, I'm trying to delegate all events of a command button to a single method, handlesAll. I wrote the following code in VS.NET 2005, and it worked fine: public void setUpDelegates() { ...
1
2435
by: tesvit | last post by:
Hi there, I am working on a class library that should incpect a given class, make a delegate to a get Property and use it later on. Here is the code snippet: public delegate int...
9
3018
by: Klaudiusz Bryja | last post by:
Hi, I need Delegate.CreateDelegate method equivalent in compact framework. Best regards, Klaudiusz
2
19389
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
7044
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,...
0
7045
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
6944
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
5341
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,...
1
4782
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...
0
4483
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2995
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...
0
2985
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
182
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...

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.