13

This is probably an incredibly obvious question, but I just can't figure it out.

I have a Windows Form managed by the form designer. I'd like to include a custom user control, also managed by the form designer. But I'm unable to get the custom control to show up in the Toolbox, even if I try manually adding it under the "Choose Items..." dialog.

Both form and control are in the same assembly. I've tried separating the control into a separate assembly in order to follow the instructions here to the letter, to no avail. I'm also using C++/CLI, if that changes anything.

Is there an attribute or such I should be setting to my control in order for it to appear in the Designer Toolbox?

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
Camille
  • 455
  • 2
  • 4
  • 11

2 Answers2

24

Yes, there is one. The only one I'm aware of that prevents a control from showing up in the toolbox if the class is in the same project. Tools + Options, Windows Forms Designer, General, AutoToolboxPopulate should be set to True. The default value.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • 1
    Actually, it seems it wasn't the default in my case. It was set to False, and unbolded as defaults usually do. That got it to show up! Now I'm getting a "Failed to load toolbox item" error, but I should be able to figure that out. – Camille Jul 08 '10 at 23:31
  • 1
    @Camille: Did you ever figure out the second one? That's the one I'm getting now. – Jonathan Wood Jan 27 '11 at 04:53
2

In the "choose items" dialog, go to ".NET Framework" tab, your control should be there

If you are from a different project, you need to add a Reference to your project first. (or dll)

In the solution explorer, right click on your project name, click add references

then you should be able to add a .NET reference to your project containing the user control

Eric
  • 19,525
  • 19
  • 84
  • 147