Ambiguous reference between an event and a method

  • Thread starter Thread starter Adrian Bojin
  • Start date Start date
A

Adrian Bojin

Hello,

I'm trying to register a private event handler on an Inspector Close event
with C#:

currInspector.Close +=Window_Close;

At design-time appears the following error message:

"Ambiguous reference:

Microsoft.Office.Interop.Outlook.InspectorEvents_10_Event.Close (Event)
Microsoft.Office.Interop.Outlook._Inspector.Close
(Method).

match."

How can I deal whit this? Thanks for any suggestions.

Sincerely, Adrian Bojin.
 
Try using the long-form handler wireup:
currInspector.Close += new SomeDelegate(Window_Close); //substitute for
'SomeDelegate'
Perhaps this will prompt the compiler to recognize that the event and not
the same-named method is intended by 'Close'.
--
David Anton
http://www.tangiblesoftwaresolutions.com
Convert C++ to C#, VB, or Java
Convert Java to C#, VB, or C++
Convert VB to C#, C++, Java, or Python
Convert C# to VB, C++, Java, or Python
 
I'm trying to register a private event handler on an Inspector Close event
with C#:

 currInspector.Close +=Window_Close;

At design-time appears the following error message:

"Ambiguous reference:

Microsoft.Office.Interop.Outlook.InspectorEvents_10_Event.Close  (Event)
Microsoft.Office.Interop.Outlook._Inspector.Close                       
(Method).

match."

How can I deal whit this? Thanks for any suggestions.

Shooting in the dark here, but try:

((InspectorEvents_10_Event)currInspector).Close += Window_Close;
 
Hi David,

thanks for the hint. I made it to work in both forms whit a cast to the
event type:

((InspectorEvents_10_Event)currInspector).Close
+=newInspectorEvents_10_CloseEventHandler(Window_Close);

or

((InspectorEvents_10_Event)currInspector).Close += Window_Close;

Kind regards, Adrian Bojin.
 
Hi David,

thanks for the hint. I made it to work in both forms whit a cast to the
event type:

((InspectorEvents_10_Event)currInspector).Close
+=newInspectorEvents_10_CloseEventHandler(Window_Close);

or

((InspectorEvents_10_Event)currInspector).Close += Window_Close;

Kind regards, Adrian Bojin.
 
Back
Top