User Controls not showing up in the toolbox

Visual Studio-2008User ControlsToolbox

Visual Studio-2008 Problem Overview


I have some UserControls that I created in ProjectA. I have ProjectB that has a windows form that I want to put the controls on. Both of these projects are in a single solution. There's a reference to ProjectA from ProjectB so it can "see" the UserControls.

However, the UserControls do not show up in the toolbox for me to drag to the windows form.

I've tried rebuilding. I've also deleted the 'bin' directory to force a rebuild-all.

How do I get VS2008 to populate the toolbox with my UserControls?

Visual Studio-2008 Solutions


Solution 1 - Visual Studio-2008

Check this setting:

Tools > Options > Windows Forms Designer > General : AutoToolboxPopulate

It should be set to True for this to work.

Solution 2 - Visual Studio-2008

  1. Build your project to make sure it compiles.

  2. With the form that you want your user control on, open the toolbox, right click and select "choose items"

  3. Browse to your .exe or dll that you compiled in step 1.

  4. make sure that your user control has a tick next to it, press OK.

  5. Your user control should appear in the toolbox, so drag it onto your form.

This is adapted from Calanus's answer to a similar question.

Solution 3 - Visual Studio-2008

In my case, the AutoToolboxPopulate was already set (Visual C# 2010 Express).

However, I had to activate "Show All" from the properties of the Toolbox (right click) to actually see my new user controls.

Solution 4 - Visual Studio-2008

Up until now, I had no problem with usercontrols not showing in the toolbox. Build the project and it just shows up. Then today not working. After a search I went through following but still no joy.

  • Tools > Options > Windows Forms Designer > General : AutoToolboxPopulate
  • Tools > Options > Text Editor > XMAL > Misc : AutoToolboxPopulate
  • Reset the VS settings to default

So after a few hours of messing around trying to get it to work with no success, I created a new WPF windows project accepting the default name and added a usercontrol. Built the project and the user control appeared as it always had.

I then thought that something might be wrong with my project or wpf window file. Removed the project, created a new one and added a new control. Built the project but it didnt work.

The only thing I did different was choose a name for the project, which I included a space in the name "WPF Application".

Removed the project again and created a new one again called "WPFApplication" without the space and added a user control. Built it and the user control showed up.

If you want usercontrols to show up automatically in the toolbox on build, dont use spaces in the project name. Hopefully this post save's someone else a ton of wasted time.

Solution 5 - Visual Studio-2008

Another reason that user controls may not show up in the toolbox is if they do not have a default constructor.

Solution 6 - Visual Studio-2008

Also double check that your user controls have a valid Namespace.

I just found that controls without namespace are not placed inside the ToolBox.

Solution 7 - Visual Studio-2008

Usually you need to build the solution. That almost always works for me.

Solution 8 - Visual Studio-2008

I had the same problem. After a lot of googling I did not find anything, but by chance I found out that if you click on the toolbox while you are in the same project that you have created the user control in, and check "show all", then a group with the same name as your project will appear at the top of toolbox which you can find your user control in. Now you can add your control on your desired form!

Solution 9 - Visual Studio-2008

For someone who might be working with ToolStripItems (e.g. ToolStripStatusLabel), to actually get your derived control to show up in the dropdown menu (such as the one from StatusStrip), you need to set the class to public then build the solution.

Also don't forget the designer attribute for your class, something like this:

using System.Windows.Forms.Design;

[ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.StatusStrip)]
public class MyStatusLabel : ToolStripStatusLabel
{
}

Took me a while to get it right. Hopefully this can save someone else's time.

Solution 10 - Visual Studio-2008

My control was public, it was checked in the 'Choose Toolbox Items' dialog, but it was still not showing up.

This is what finally worked for me:

Right click somewhere in the Toolbox and click 'Choose Items'. When I found my item it was already checked. I then unchecked the item and clicked okay. Next I right clicked the toolbox again and searched for my item... it was gone, so I clicked Browse, navigated to the obj/x86/debug folder and selected my exe. The item was then added correctly to the toolbox.

I think it's a VS bug.

Solution 11 - Visual Studio-2008

Apart all instructions that have been given(Tools > Options > Windows Forms Designer > General : AutoToolboxPopulate) + you need to build the solution (which is obvious for me) you will probably have to pay attention to the class access modifier: it MUST be PUBLIC. I just created a control and did not appeared in toolbox list and I did not knew why. So after set

public class  yourClass:control {}

than it appeared in list. ;) Hope this will help others.

Solution 12 - Visual Studio-2008

Check your build output directory. If for some reason you are building your output somewhere other than the project bin\ directory, your controls won't show up in your toolbox.

Solution 13 - Visual Studio-2008

Here was my problem: I had added a new constructor for my control which accepted a few arguments, but I had not explicitly re-declared the empty constructor! The toolbox can only include controls which have empty constructors. In general, when you are designing a class in vb, it has an empty constructor defined implicitly (meaning you don't need to declare one). BUT, as soon as you start designing your own constructors, this empty constructor disappears, so you need to explicitly redefine it in your code! Anyways, I realize most experienced vb coder's already know all this, but hopefully this can help some newbies like myself :).

Solution 14 - Visual Studio-2008

What I usually do is create a new tab and add the exe/dll to that tab... Not too comfortable with that solution because of the load time and general hassle.

A friend showed me a way to speed this up. Instead of having to click "Choose Items..." in the toolbox,etc, for each new control you make - You can create a file named MyCustomControls and there you can create your custom controls.

Now you only have to do the "Choose Items..." and add this file ONCE. If you later on decide to add a new control, create it in MyCustomControls and then rebuild.
Then your toolbox will have your new control. (It will be displayed automatically with a regular compile if you have AutoToolboxPopulate I think)

This is unfortunate, because often you want to separate classes into "one class per file". It is horrible that you have to ruin your code architecture just because VS doesn't want to do it your way. :)

I am not too comfortable with this solution either but if you need to do something quick and you don't care about multiple user controls within a file or just are lazy, this might suit you well. :)

Solution 15 - Visual Studio-2008

It is possible for all of the above to fail.

I fixed it by creating a new user control (TestControl) and it triggered Visual Studio to magically add my project's controls tab + controls back into the Toolbox. Then I just deleted the test control.

This happened to me after recently installing a VS 2008 automated windows update, by the way.

Solution 16 - Visual Studio-2008

Well, nothing was working for me except this worked...

  1. I create a new project in my solution, and for this project it works so I was going to start using this one
  2. Playing arond, I started tweaking the xml of the csproj file to find out what was wrong with my other project in the same solution and then I reset it as it didn't seem to be working
  3. It is now magically working again in my project

Not a very good solution but you should try these steps

  1. See if it works in a brand new solution/project.
  2. See if it works in a brand new project in the same solution
  3. If #2 worked, maybe compare .csproj files...somehow mine started working again while I was doing this(this is very frustrating).

Solution 17 - Visual Studio-2008

Providing you already tried tinkering with:

  • Tools > Options > Windows Forms Designer > General : AutoToolboxPopulate
  • Tools > Options > Text Editor > XMAL > Misc : AutoToolboxPopulate
  • created a default constructor
  • build your project / reset the toolbox and add manually your tab

Yet you still see it greyed out..

Check your path length and check the charcters being used in your absolute path.

I had a project residing in "C:\Users\myName\myCompany\R&D\Projects"
And after few hours found out that the "R&D" is the problem..
The '&' did not allow my usercontrol items to be enabled in my toolbox.

Solution 18 - Visual Studio-2008

I fell into this trap just a couple of hours ago.
I've got a .NET 2.0 Windows Application project with some custom UserControls; it worked fine. So I decided to order my files in subfolders, to make my project a little bit cleaner.
After that, Visual Studio 2010 designer stopped loading my forms, and ToolBox won't show my controls anymore.
I freaked out, moving back source files in project root, resetting ToolBox, but nothing seemed to work. After that, I remembered I used ReSharper "Remove Unused References", so I tried to put back unused reference, in particular System.Data: problem solved! :O I can't say you why, but this worked for me.
Hope my experience can help someone else. :)
Bye, Nando

Solution 19 - Visual Studio-2008

If you still can't find why your vstudio toolbox is not populated with your usercontrols. Then you can debug vstudio with another visual studio. Here you can find how.

Solution 20 - Visual Studio-2008

If you've tried following all the other answers and it still doesn't work, the following fixed it for me:

  • Right click on your project containing your control.
  • Select Properties.
  • In the Build settings category, make sure Register for COM interop is checked.

Solution 21 - Visual Studio-2008

In my case the reason of error was an excess length of a path to my control's .dll. I had shrunk it a bit and everything became working fine.

Also I found out that the special symbols (e.g. I used #) in a path affect a control display.

Hope it solves the issue.

Solution 22 - Visual Studio-2008

I was trying to build a x64 only application, so my platform target was set to x64 of course.

However, even in 2016, Visual Studio (devenv.exe) is still a 32 bit process and it cannot load 64 bit assemblies. To check the bitness of your Visual Studio, open Task Manager and check for *32 at the name of the process.

Workaround to see the Controls in the toolbox: set the platform target to Any CPU in the project settings. Do that for Debug and Release build, if necessary.

Solution 23 - Visual Studio-2008

As mentioned here you should tell the visual studio to load your usercontrol in toolbox.

[ToolboxItem(true)]
public class PanelTitle : LabelControl  {
// Whatever code to override LabelControl here...
}

Solution 24 - Visual Studio-2008

When I tried to add my UserControl to the toolbox (right click toolbox, choose items, select my DLL) it would display a message saying there were no controls in my DLL.

Anyway, the problem was solved, by trying to create a form in my DLL in VS and adding the UserControl. An error message displayed saying there was no default constructor

public UserControl() {
...
}

The designer needs this because it can't know what valid arguments are. Once I added a blank constructor to the UserControl it was added to the toolbox without issue.

Solution 25 - Visual Studio-2008

In your UserControl, make sure that New is declared Public. It won't show up if it's just declared Sub New (which defaults to Friend).

Solution 26 - Visual Studio-2008

Symptom 1: The Design Views for Form, UserControl, & Component were FAILING!

  • My Form design view was failing w/ the msg "can not find 'User Control'."
  • If I could get the Form design view to work it was very unstable & corrupted all to hell w/ any change.

Symptom 2: The UserControl & Component in the Toolbox

  • Were grayed out in the Toolbox & showed a garbled name
  • "Choose item" in the Toolbox context menu showed garbled name & no namespace

Solution: Set scope to Public in the vb behind UserControl, & Component

Solution 27 - Visual Studio-2008

Check project path, avoid & , # etc.

I've moved my solution from drive:\work\c#\folder\ to drive:\work\folder and it solved the problem.

Solution 28 - Visual Studio-2008

Before trying to add a custom control, make sure that it is compatible with the .Net version of your current project.

I was trying to add a custom control to toolbox for a project for Windows CE 5.0 and .Net Compact v3.5 on VS2008. I did all those previous suggestions but nothing worked. The control shows up when "show all" is checked but it is grayed , even in "Choose Items" menu is checked.

I created a new project with .Net v2.0 and it worked perfectly.

Solution 29 - Visual Studio-2008

hello its answer Ctrl+Alt+X take this and later u have TOOLBOX :)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRobert DemlView Question on Stackoverflow
Solution 1 - Visual Studio-2008Ryan LundyView Answer on Stackoverflow
Solution 2 - Visual Studio-2008Don KirkbyView Answer on Stackoverflow
Solution 3 - Visual Studio-2008Maxime LarocqueView Answer on Stackoverflow
Solution 4 - Visual Studio-2008John PetrakView Answer on Stackoverflow
Solution 5 - Visual Studio-2008wlfView Answer on Stackoverflow
Solution 6 - Visual Studio-2008SoMoSView Answer on Stackoverflow
Solution 7 - Visual Studio-2008Filip FrączView Answer on Stackoverflow
Solution 8 - Visual Studio-2008SiyavashView Answer on Stackoverflow
Solution 9 - Visual Studio-2008Dan7View Answer on Stackoverflow
Solution 10 - Visual Studio-2008ChriszimortView Answer on Stackoverflow
Solution 11 - Visual Studio-2008Alexa AdrianView Answer on Stackoverflow
Solution 12 - Visual Studio-2008RussellView Answer on Stackoverflow
Solution 13 - Visual Studio-2008BrianEslerView Answer on Stackoverflow
Solution 14 - Visual Studio-2008DavidMBView Answer on Stackoverflow
Solution 15 - Visual Studio-2008codenheimView Answer on Stackoverflow
Solution 16 - Visual Studio-2008Dean HillerView Answer on Stackoverflow
Solution 17 - Visual Studio-2008G.YView Answer on Stackoverflow
Solution 18 - Visual Studio-2008Ferdinando SantacroceView Answer on Stackoverflow
Solution 19 - Visual Studio-2008stivoberlinView Answer on Stackoverflow
Solution 20 - Visual Studio-2008Forest KuneckeView Answer on Stackoverflow
Solution 21 - Visual Studio-2008Alex UrazaevView Answer on Stackoverflow
Solution 22 - Visual Studio-2008Thomas WellerView Answer on Stackoverflow
Solution 23 - Visual Studio-2008HamedView Answer on Stackoverflow
Solution 24 - Visual Studio-2008MartinView Answer on Stackoverflow
Solution 25 - Visual Studio-2008smirkingmanView Answer on Stackoverflow
Solution 26 - Visual Studio-2008Buddha BearView Answer on Stackoverflow
Solution 27 - Visual Studio-2008user3611840View Answer on Stackoverflow
Solution 28 - Visual Studio-2008AouffenView Answer on Stackoverflow
Solution 29 - Visual Studio-2008MéhmétCãn KãrãView Answer on Stackoverflow