Ambiguous reference by registering a private event handler

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.
 
K

Ken Slovak - [MVP - Outlook]

Try something like this and see if that gets rid of that warning:

((Outlook.InspectorEvents_Event)currInspector).Close += new
Outlook.InspectorEvents_CloseEventHandler(Window_Close);

That will directly cast the event as an event and remove the ambiguity. The
same approach can be followed for any other case where a method and event
share the same name.
 
C

Colbert Zhou [MSFT]

Hello Adrian,

This is also documented in the our VSTO FAQ, :)
http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/d31413c0-0016-40f2
-8dcf-f4c3483cb49c


Best regards,
Colbert Zhou (colbertz @online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
[email protected].

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Top