User Controls not showing up in the toolbox

前端 未结 29 2157
暗喜
暗喜 2020-12-13 12:21

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 sol

相关标签:
29条回答
  • 2020-12-13 12:22

    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.

    0 讨论(0)
  • 2020-12-13 12:22

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

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

    0 讨论(0)
  • 2020-12-13 12:22

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

    0 讨论(0)
  • 2020-12-13 12:23
    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.

    0 讨论(0)
  • 2020-12-13 12:23

    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.

    0 讨论(0)
  • 2020-12-13 12:25

    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.

    0 讨论(0)
提交回复
热议问题