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
- Type oType = Type.GetTypeFromProgID("Outlook.Application");
- oApp = Activator.CreateInstance(oType);
- oInspectors = oApp.GetType().GetProperty("Inspectors").GetValue(oApp, null);
- e_NewInspector = oInspectors.GetType().GetEvent("NewInspector");
- d_NewEventDelegate = Delegate.CreateDelegate(e_NewInspector.EventHandlerType,
- this, "Inspectors_NewInspector");
Expand|Select|Wrap|Line Numbers
- private void Inspectors_NewInspector(object insp, System.IntPtr param){ .... }
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?