Right-click on toolbar then click on "choose item" in context menu. A dialog with registered components pops up. in this dialog click "Browse" to select your assembly with the usercontrol you want to use.
In your original Project, choose File|Export template
Then select ItemTemplate and follow the wizard.
Move your UserControl to a separate ClassLibrary (and fix namespaces etc).
Add a ref to the classlibrary from Projects that need it. Don't bother with the GAC or anything, just the DLL file.
I would not advice putting a UserControl in the normal ToolBox, but it can be done. See the answer from @Arseny
Let's say you have a Windows.Forms project. You add a UserControl (say MyControl) to the project, and design it all up. Now you want to add it to your toolbox.
As soon as the project is successfully built once, it will appear in your Framework Components. Right click the Toolbox to get the context menu, select "Choose Items...", and browse to the name of your control (MyControl) under the ".NET Framework Components" tab.
Advantage over using dlls: you can edit the controls in the same project as your form, and the form will build with the new controls. However, the control will only be avilable to this project.
Note: If the control has build errors, resolve them before moving on to the containing forms, or the designer has a heart attack.
I had problems getting them to add automatically to the toolbox as in VS2008/2005.
There's actually an option to stop the toolbox auto-populating!
Go to Tools > Options > Windows Forms Designer > General
At the bottom of the list, you'll find Toolbox > AutoToolboxPopulate which on a fresh install defaults to False. Set it true and then rebuild your solution.
Hey presto, the user controls in your solution should be automatically added to the toolbox.
I had many users controls but one refused to show in the Toolbox, even though I rebuilt the solution and it was checked in the Choose Items... dialog.
Solution:
From Solution Explorer I Right-Clicked the offending user control file and selected Exclude From Project
Rebuild the solution
Right-Click the user control and select Include in Project (assuming you have the Show All Files enabled in the Solution Explorer)
Note this also requires you have the AutoToolboxPopulate option enabled. As @DaveF answer suggests.
Alternate Solution: I'm not sure if this works, and I couldn't try it since I already resolved my issue, but if you unchecked the user control from the Choose Items... dialog, hit OK, then opened it back up and checked the user control. That might also work.
Basic qustion if you are using generics in your base control.
If yes:
lets say we have control:
public class MyComboDropDown : ComboDropDownComon<MyType>
{
public MyComboDropDown() { }
}
MyComboDropDown will not allow to open designer on it and will be not shown in Toolbox.
Why? Because base control is not already compiled - when MyComboDropDown is complied.
You can modify to this:
public class MyComboDropDown : MyComboDropDownBase
{
public MyComboDropDown() { }
}
public class MyComboDropDownBase : ComboDropDownComon<MyType>
{
}
Than after rebuild, and reset toolbox it should be able to see MyComboDropDown in designer and also in Toolbox
In my case, I couldn't see any of the controls in the project. Only when right clicking on toolBox and selecting "Show All" I saw them, but yet they were disabled...
Changing Project type from Windows application to ClassLibrary made the fix.