User Controls not showing up in the toolbox

2019-01-21 21:19发布

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?

29条回答
男人必须洒脱
2楼-- · 2019-01-21 21:59
  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.

查看更多
SAY GOODBYE
3楼-- · 2019-01-21 21:59

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.

查看更多
做自己的国王
4楼-- · 2019-01-21 22:01

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

查看更多
太酷不给撩
5楼-- · 2019-01-21 22:01

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.

查看更多
Rolldiameter
6楼-- · 2019-01-21 22:02

Check this setting:

Tools > Options > Windows Forms Designer > General : AutoToolboxPopulate

It should be set to True for this to work.

查看更多
登录 后发表回答