Finchsize
Finchsize

Reputation: 935

C# using System.Windows.Forms does not exist

I tried to add:

using System.Windows.Forms 

But its shows me an error.

I know I must assembly that to my VS2012 but I srsly don't know how. I was searching everywhere and tried everything I've found but none of this helps me.

@edit 1 hour of searching in the web and... 2 minutes after write this post i found... Project >> add Reference...

Solved :]

Upvotes: 6

Views: 16555

Answers (3)

Ascyt
Ascyt

Reputation: 27

For people with .NET 6.0:

Add this to your .csproj file (click on the file named after your project in Solution Explorer) before the </Project>:

<PropertyGroup>
    <TargetFramework>net6.0-windows</TargetFramework>
    <UseWPF>true</UseWPF>
    <UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

Upvotes: 0

Castiblanco
Castiblanco

Reputation: 1198

If you're using Visual Studio, right click the References folder in your project, select Add Reference... and then on the .NET tab, choose System.Windows.Forms and click OK.

Upvotes: 11

Piotr Zierhoffer
Piotr Zierhoffer

Reputation: 5139

Right click on project references in Solution Explorer, choose Add Reference..., there you have to find System.Windows.Forms assembly (under Assemblies=>Framework) and add it to the project.

Upvotes: 5

Related Questions