User controls do not appear in the toolbar

I have some UserControls that I created in ProjectA. I have a ProjectB that has a window shape that I want to include controls on. Both of these projects are in one solution. There's a link to ProjectA from ProjectB so that it can "see" UserControls.

However, UserControls do not appear in the toolbar so I drag them into the Windows form.

I tried rebuilding. I also deleted the "bin" directory to force restore everything.

How do I get VS2008 to populate a toolbar with UserControls?

+71
visual-studio-2008 user-controls toolbox
Nov 13 '08 at 19:58
source share
29 answers

Check this option:

Tools> Options> Windows Forms Designer> General: AutoToolboxPopulate

This must be set to True.

+80
Nov 13 '08 at 20:12
source share
  • Create your project to make sure it compiles.

  • In the form that you want your user to control, open the toolbar, right-click and select "select items"

  • Go to your .exe or dll that you compiled in step 1.

  • make sure your user control has a checkmark next to it, click OK.

  • The custom control should appear in the toolbar, so drag it into the form.

This is adapted from Calanus to answer a similar question .

+29
Nov 24 '09 at 20:14
source share

In my case, AutoToolboxPopulate is already installed (Visual C # 2010 Express).

However, I had to activate “Show All” from the toolbar properties (right-click) to see my new user controls.

+18
Jul 22 2018-10-22T00:
source share

So far I have not had problems with usercontrols that do not appear in the toolbar. Create a project and it just appears. Then it’s not working today. After the search, I went through the next, but still not joy.

  • Tools> Options> Windows Forms Designer> General: AutoToolboxPopulate
  • Tools> Options> Text editor> XMAL> Miscellaneous: AutoToolboxPopulate
  • Reset VS default settings

So, after several hours of turmoil, trying to get it to work without success, I created a new Windows WPF project that accepted the default name and added usercontrol. Built the project, and the user control appeared, as always.

Then I thought something might be wrong with my project or wpf window file. We deleted the project, created a new one and added a new control. Built a project, but it didn’t work.

The only thing I did differently was to choose a name for the project, in which I included a space in the name of “WPF Application”.

Deleted the project again and created a new one, again called "WPFApplication" without a space, and added a user control. Built, and the user control appeared.

If you want usercontrols to automatically appear in the toolbar during assembly, do not use spaces in the project name. Hope this post saves someone else a ton of wasted time.

+11
Dec 05 2018-10-12T00:
source share

Another reason that user controls may not appear in the toolbar is because they do not have a default constructor.

+6
Apr 3 2018-12-12T00:
source share

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

I just found that controls without a namespace do not fit inside the ToolBox.

+5
Mar 23 '09 at 8:44
source share

Usually you need to build a solution. It almost always works for me.

+4
Nov 13 '08 at 20:00
source share

I had the same problem. After many searches, I didn’t find anything, but I accidentally found that if you click on the toolbar when you are in the same project in which you created the user control and check “ show all ”, then the group with the same name as your project will appear at the top of the toolbar, in which you can find your custom control. Now you can add your control to the desired form!

+3
Nov 21 '11 at 8:18
source share

For those who can work with ToolStripItems (e.g. ToolStripStatusLabel ) in order to actually get their derived control to be displayed in a drop-down menu (e.g. from StatusStrip ) , you need to set the public class , then create a solution.

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

 using System.Windows.Forms.Design; [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.StatusStrip)] public class MyStatusLabel : ToolStripStatusLabel { } 

Took me to get it right. Hope this can save someone else time.

+3
Nov 23 2018-11-11T00:
source share

My control was publicly available, it was checked in the "Select Toolbar Elements" dialog box, but it still didn't appear.

Here is what finally helped me:

Right-click anywhere in the toolbar and select "Select Items." When I found my product, it was already checked. Then I unchecked the box and clicked OK. Then I clicked the toolbar again and looked for my item ... it disappeared, so I clicked the Browse button, went to the obj / x86 / debug folder and selected my exe. Then the item was correctly added to the toolbar.

I think this is VS error.

+3
Jan 10 '13 at
source share

In addition to all the instructions that were provided (Tools> Options> Windows Forms Designer> General: AutoToolboxPopulate) + you need to build a solution (which is obvious to 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 appear in the list of tools, and I did not know why. Therefore, after installation

 public class yourClass:control {} 

how did he appear on the list .;) I hope this helps others.

+3
Feb 20 '13 at 7:35
source share

Check the source directory of the assembly. If for some reason you create output somewhere other than the bin \ project directory, your controls will not appear in the toolbar.

+2
Nov 21 '11 at 21:21
source share

Here is my problem: I added a new constructor for my control, which took a few arguments, but I did not explicitly declare an empty constructor! A toolkit can only include controls that have empty constructors. In general, when you develop a class in vb, it has an empty constructor defined implicitly (this means that you do not need to declare it). BUT, as soon as you start creating your own constructors, this empty constructor disappears, so you need to explicitly override it in your code! In any case, I understand that most experienced vb encoders already know all this, but hopefully this can help some newbies like me :).

+2
Jul 09 '14 at 16:23
source share

Usually I create a new tab and add exe / dll to this tab ... Not too convenient with this solution due to load time and common problems.

A friend showed me a way to speed it up. Instead of clicking "Select Items ..." in the toolbar, etc. For each new control you create, you can create a file called MyCustomControls and there you can create your own controls.

Now you only need to do "Select Elements ..." and add this file ONE. If you later decide to add a new control, create it in MyCustomControls and then rebuild.
Then your toolkit will have your new control. (It will be displayed automatically with regular compilation if you have AutoToolboxPopulate I think)

This is unfortunate because often you want to split classes into "one class per file". It's terrible that you should ruin your code architecture just because VS doesn't want to do it in its own way. :)

I am not too comfortable with this solution, but if you need to do something quickly and you don’t care about a few user controls in the file or are just lazy, this may work well for you. :)

+1
Nov 04 '09 at 9:01
source share

It is possible that all of the above has not been completed.

I fixed it by creating a new user control (TestControl) and he called Visual Studio to magically add the project control tab + controls back to the toolbar. Then I just deleted the control control.

This happened to me after a recent installation of automatic updating of Windows VS 2008, by the way.

+1
May 25 '11 at 21:58
source share

Well, nothing worked for me, except that it worked ...

  • I create a new project in my solution, and it works for this project, so I'm going to start using this
  • While playing arond, I started setting up the xml of the csproj file to find out what was wrong with my other project in the same solution, and then I reset because it did not seem to work
  • Now this magic works again in my project

Not a good solution, but you should try these steps.

  • See if this works in a new solution / project.
  • See if he is working in a new project in the same solution.
  • If # 2 worked, maybe compare the .csproj files ... somehow mine started working again while I was doing this (it is very frustrating).
+1
Jun 08 2018-12-12T00:
source share

Ensuring that you have already tried to mess with:

  • Tools> Options> Windows Forms Designer> General: AutoToolboxPopulate
  • Tools> Options> Text editor> XMAL> Miscellaneous: AutoToolboxPopulate
  • created default constructor
  • create your project / reset toolbar and manually add a tab

However, you still see that it is inactive.

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

I had a project located in "C: \ Users \ myName \ myCompany \ R & D \ Projects"
And a few hours later it turned out that the problem is "R & D" .
" & " did not allow the inclusion of user controls in the toolbar.

+1
Jun 09 2018-12-12T00:
source share

I fell into this trap just a couple of hours ago.
I have a .NET 2.0 Windows Application application project with some custom UserControls; It worked fine. So I decided to order the files in subfolders to make my project a little cleaner.
After that, the designer of Visual Studio 2010 stopped loading my forms, and the ToolBox will no longer display my controls.
I got scared by moving the source files to the root of the project, dropping the ToolBox, but nothing worked. After that, I remembered that I used ReSharper "Delete unused links", so I tried to return an unused link , in particular System.Data strong>: the problem is solved !: O I can not say why, but it worked for me.
Hope my experience helps someone else. :)
Bye Nando

+1
Jul 03 2018-12-12T00:
source share

If you still cannot find out why your vstudio toolkit is not populated with your user preferences. Then you can debug vstudio with another visual studio. Here you can find how .

+1
Mar 22 '13 at 7:56
source share

If you tried to complete all the other answers and still does not work, the following is fixed for me:

  • Right-click your project containing your control.
  • Choose Properties .
  • In the Build settings category, make sure Register for COM interop .
+1
Aug 09 '13 at 17:09
source share

In my case, the cause of the error was the excessive path length to my .dll control. I cut it a little, and everything began to work fine.

I also found that special characters (for example, I used #) in the path affect the display of control.

Hope it solves the problem.

+1
Oct 22 '13 at 9:47 on
source share

When I tried to add my UserControl to the toolbar (right-click the toolbar, select items, select my DLL), it will display a message stating that there were no controls in my DLL.

In any case, the problem was solved by trying to create a form in my DLL in VS and adding UserControl. I got an error message that didn't have a default constructor

 public UserControl() { ... } 

The designer needs this because he cannot know what are the valid arguments. As soon as I added an empty constructor to UserControl, it was added to the toolbar without any problems.

0
Jan 29 '13 at 1:18
source share

In your UserControl, make sure New is declared Public . It will not be displayed if it simply declares Sub New (Friend is used by default).

0
Feb 27 '14 at 8:35
source share

Symptom 1: Design representations for the form, UserControl, and component were FAILING!

  • In my view with form design, ms / msg is missing. "Cannot find" User Control ".
  • If I could get a representation of the form in order to work, it was very erratic and distorted to hell with any changes.

Symptom 2: UserControl and component in Toolbox

  • The toolbars were grayed out and a distorted name is shown
  • "Select item" toolbar context menu displays garbled name and namespace

Decision. Set the scope to Public in vb for UserControl and Component

0
Apr 01 '14 at 16:57
source share

Check the project path, avoid & , # , etc.

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

0
May 7 '14 at 10:58
source share

I tried to create an application for x64 only, so my target platform was installed on x64 , of course.

However, even in 2016, Visual Studio ( devenv.exe ) is still a 32-bit process and cannot load 64-bit assemblies. To check the Visual Studio bitta, open the task manager and check *32 for the process name.

Workaround for viewing controls in the toolbar: set the target platform Any CPU in the project settings. Do this to build Debug and Release, if necessary.

0
Jul 14 '16 at 19:16
source share

As mentioned here , you must tell the visual studio to load your usercontrol in the toolbar.

 [ToolboxItem(true)] public class PanelTitle : LabelControl { // Whatever code to override LabelControl here... } 
0
Dec 18 '16 at 7:46
source share

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

I tried to add a custom control to the project toolbar for Windows CE 5.0 and .Net Compact v3.5 on VS2008. I made all these previous suggestions, but nothing worked. The control is displayed when "show all" is checked, but it is gray, even in the "Select Items" menu.

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

0
Jan 26 '17 at 18:52
source share

hi his answer is Ctrl + Alt + X take this and then you have TOOLBOX :)

-one
Jun 12 '13 at 10:03
source share



All Articles