Add a custom control (component) to my Toolbox

cmh_rwhelan
cmh_rwhelan used Ask the Experts™
on
I have a new custom control called CustomListBox,  I have added it to a Project in my VS 2008 Windows Forms appllication.   It is saved as CustomListBox.cs.
I would like to add it to my Controls toolboxin the VS IDE, but when I try to Choose Items in the Toolbox, it is ,of course, looking for a .dll, not a .cs project file.

What's the trick??

Thanks  ...
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Adam MenkesC# ASP.NET Developer
Top Expert 2010
Commented:
You can either add this project into a solution, or add a reference and point to the DLL that you created from your customlistbox project.

Author

Commented:
Still missing something:

What I am missing is the DLL - I created the CustromChecked List box as a New Item within a Project., so it is saved in the Project's directory as a .cs file.
C# ASP.NET Developer
Top Expert 2010
Commented:
If you plan to use the custom control in several projects, what you would do is create a new project of type Class Library. Compile it, and it will create a DLL. Now you can add it to multiple projects.

If you only want to include it in the current project, just add the project (you can have several projects in a solution), or just add the .cs file to the existing project.

When you compile the new project, it will be available.

Author

Commented:
Never mind - I have it - I just wasn't looking carefully - it was already added to the Toolbox, but was out of alphabetical order - duh...

Thanks for the solution - I can see how it works as you describe it

RW
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009

Commented:
If the control is physically added to your project then just BUILD it and then new control should appear at the top of the ToolBox:
ToolBox-CustomControl-UserContro.jpg

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial