views:

18

answers:

2

I have created a user control in a .dll. I have a reference to that .dll in my project in visual studio.

How can I get the control to display in my toolbox pane?

A: 

Use ToolboxItemAttribute:

http://msdn.microsoft.com/en-us/library/system.componentmodel.toolboxitemattribute.aspx

Jakub Konecki
How do I use the attribute? Suppose I want to add it to a toolbox category called "My Stuff".
lejon
+1  A: 

You should right-click the Toolbox area, click on "Choose Items", in the ".Net Framwork Components" tab click on "Browse". Then select the .dll where your user control is and click OK. Then make sure the line of your newly added control is marked and click OK. It should be available now in the Toolbox.

Alternatively you could add the project of your user control in the solution and it should automatically be added to the toolbox (at the top).

Gimly
I will do that until I figure out the ToolboxItemAttribute
lejon
The ToolboxItemAttribute defines how the toolbox displays your control, but will not magically add it to it. So you'll still have to add it "manually" using the steps I explained.
Gimly