M
Max
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:
The class that is supposed to handle the event is defined as follows:
What am I doing wrong?
ArgumentException when I create a delegate. The arguments I pass seem valid.
This is my code:
Code:
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");
The class that is supposed to handle the event is defined as follows:
Code:
private void Inspectors_NewInspector(object insp){ .... }
What am I doing wrong?