12

I'm using C# to command something in Excel but when I type

using System.Windows.Forms

it's not recognized by Visual Studio When I added the reference, I have this error message

A reference to 'System_Windows_Forms' could not be added. The ActiveX type library '...' was exported from a .NET assembly and cannot be added as a reference. Add a reference to the .NET assembly instead

Do you have any solutions?

1
  • 1
    You should not be typing this by hand usually, if your project is a winforms project then the correct references are added by default in Visual Studio. Commented May 2, 2011 at 16:00

2 Answers 2

27

Did you try to add it from the COM-tab? Find the System.Windows.Forms.dll in the .NET-tab instead! (Sorting the dll-s by name makes it so much easier to find the right one.)

Sign up to request clarification or add additional context in comments.

Comments

0

Reference Manager>Assemblies>Framework enter image description here

2 Comments

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
Where is the "Reference Manager"?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.