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?
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 fromStatusStrip
), you need to set the class topublic
then build the solution.Also don't forget the designer attribute for your class, something like this:
Took me a while to get it right. Hopefully this can save someone else's time.
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 :).
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.
Symptom 1: The Design Views for Form, UserControl, & Component were FAILING!
Symptom 2: The UserControl & Component in the Toolbox
Solution: Set scope to Public in the vb behind UserControl, & Component
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.
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.