I have a problem.It's "button is an ambiguous reference between Excel.Button and System.Windows.Forms.Button"

can you help me?

tnks.
gorurum
0

Comments

1 comment

  • Alexander Morou
    Your question is a bit vague. You didn't provide information as to where you're receiving this error. Is this within Visual Studio itself, a direct command line compile of the code, or otherwise? The likely problem is that you've included a using directive for Excel and System.Windows.Forms and both name spaces contain an entry for 'Button'. This would cause a symbol resolution ambiguity between the two namespaces.

    To resolve this issue, either specify the namespace and class-name directly (ala. System.Windows.Forms.Button) or include a few aliases which resolve the ambiguity by introducing a new symbol that's unambiguous, such as:
    using SButton = System.Windows.Forms.Button;
    using EButton = Excel.Button;
    
    Naturally the names you'd use for both cases need to also be unambiguous, or similar problems may result. You can also create a namespace alias like so:
    using E = Excel;
    using Forms = System.Windows.Forms;
    
    Then utilize namespace qualifiers to resolve it in a terser, yet correct, manner (versus the verbose full namespace+class form):
    E::Button or Forms::Button.

    That's the furthest I can answer your question given the lack of more information. This is really a forum for support of the Red Gate Reflector program, though.
    Alexander Morou
    0

Add comment

Please sign in to leave a comment.