Ambiguity between methods ... Using method group?!

Why do I get the following message when I am trying to rebuild my solution !

Warning 1 Ambiguity between method 'Microsoft.Office.Interop.Word._Document.Close(ref object, ref object, ref object)' and non-method 'Microsoft.Office.Interop.Word.DocumentEvents2_Event.Close'. Using method group. C:\Documents and Settings\Charoite\My Documents\Visual Studio 2005\Projects\InteropProject\Microsoft\WordPrinter.cs 27 27 InteropProject

Warning 2 Ambiguity between method 'Microsoft.Office.Interop.Word._Application.Quit(ref object, ref object, ref object)' and non-method 'Microsoft.Office.Interop.Word.ApplicationEvents4_Event.Quit'. Using method group. C:\Documents and Settings\Charoite\My Documents\Visual Studio 2005\Projects\InteropProject\Microsoft\WordPrinter.cs 28 30 InteropProject

How could I avoid such messages Thanks for any advance.



Answer this question

Ambiguity between methods ... Using method group?!

  • chowdharyrohit

    I've never seen this before, but my guess is that you have an object that implements both the _Document interface and the DocumentEvents2_Event interface. The _Document interface defines a member named 'Close' which is a method, and the DocumentEvents2_Event has an event named 'Close'. So, the name is ambiguous, but it is guessing from the context that you mean the method no the event. To fix it, try casting your object to the _Document interface and then calling the Close method. If that works, try a similar thing with the second warning.
  • Bigs

    Nimrand

    The problem has been solved. Thanks.

    Charoite


  • clintonG

    excellent Charoite...but HOW was it solved

    i'm in a simular situation..with the added issue that i'm left with houndreds of Word instances in my task manager..for some reason it's not being released at all...


  • mkbbrt

    Hello CSharpZealot

    Did you get your error message during compilation time or runtime For my situation, I had just correct my code from:

    private Document document;

    to

    private _Document document;

    In order to specify what type I am trying to point.

    For your situation, I guess you have put the code

    document.Close();

    right But so sorry that I don't know what's the error message you have got Thank you.

    Charoite

    P.S. I am just lucky, not excellent


  • Ambiguity between methods ... Using method group?!