How to add custom control in Visual Studio Toolbox.

20 07 2008

How to add custom control in Visual Studio Toolbox.

In my previous article Creating Custom Controls in ASP .Net  we have seen the technical approach for creating custom control and  in How to make better appearance of your custom control in Visual Studio we have gone through the design aspects of custom control.

Now in this article I will explain how to add your custom control to your Toolbox.


Making Custom Control Class Library Project.

Step 1 – Create a class library project named myControlLib.

Step 2 – Add the following code to a new class named myImage. To download sample code files click here. After downloading add “myImage.cs” and “myImageLogo.bmp” file to your “myControlLib” project. Change the “Build Action” property of “myImageLogo.bmp” to Embedded Resource.

Step 3 – Compile the project.

Note: Above given steps are specific to the code sample that I have created. If you want to rename any of the file or change any other aspects than make sure that you also change the design time attributes of your control.

Example: [Designer (“myControlLib.myImageDesigner,myControlLib”)] uses the namespace “myControlLib” that is directly related to the name of the class library project you make.


Adding custom control to toolbox.

Step 1 – Switch over to the web project in which you want to use the control.

Step 2 – In toolbox add your own tab or click on general tab.

Step 3 – Right click in the selected tab area and click Chose Items.

Step 4 – This will open Choose Toolbox Item screen. Click on Browse button and specify the path of dll you created in your myControlLib project.

Step 5 – Click Ok and you’re done. Your Custom control will be added to the toolbox as shown below.




13 responses

7 08 2008

Nice One. It help me a bit…

4 11 2008

how to compile more then one control in one dll?
when i build dll with 2 controls, toolbox adds only 1 control

4 11 2008

nvm, all works fine 😀

17 02 2009

How can we load the WPF custom controls programatically?

27 03 2009

Magic, cheers for the assistance.

20 02 2010
Nauman khattak

Thanks dear

8 03 2010

Cool one!! It really helped me a lots!!

22 11 2010

Thanks it helped me.

14 12 2010
Mike Schneider

This was a big help. Thank you very much.

25 04 2011

Is this is the same in VS 2010 ?

8 05 2011
Dhaval Upadhyaya


29 08 2011


7 09 2012
seema trivedi

superb! thank you soooooooooooooo much..

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: