Spedwards
Spedwards

Reputation: 4492

New Windows Forms Item

First of all, I have no idea what these are called so I had no way of searching to see if this question existed.

Essentially, I'm looking to create a new item that gets added to the Toolbox, like a Textbox. I saw this but it was posted 5 years ago and had trouble understanding how it worked.

I tried creating a Class Library, importing System.Windows.Forms so I could inherit Textbox but it kept saying that Forms is not a namespace or type in System.Windows.

What do I do? Also, what are these called so I can search in future?

Upvotes: 0

Views: 30

Answers (1)

Fᴀʀʜᴀɴ Aɴᴀᴍ
Fᴀʀʜᴀɴ Aɴᴀᴍ

Reputation: 6251

You must add a reference to System.Windows.Forms in your project like this:

Step 1 : Go to MenuBar -> Project -> Add Reference.

Step 1

Step 2: On the left, navigate to Assemblies -> Framework. On the right scroll down and make sure System.Windows.Forms is checked. Click OK.

enter image description here

Similarly, for other errors like that, make sure that there is a reference to the assembly the error points to and if not add it using the steps above.

The error that you get is called a 'Missing Assembly Reference Error'.

Upvotes: 1

Related Questions