1

I have a UserContol which is just a group of 9 TextBoxs in a GroupBox which represent the elements of a 3x3 matrix. I was trying to add this control to the toolbox so I could drag and drop it using the designer but I can't figure out how. I have seen a number of instructions on how to add an entire .dll with custom controls but I just want to add one for two. Must I have separate projects for the controls and the main program? If so why would it be designed like this? What if I wanted to write methods in my control that wanted to reference types defined in my main project?

Thanks Alex

Alexander Van Atta
  • 870
  • 11
  • 34
  • 1
    In this question [How to put a UserControl into Visual Studio toolBox](http://stackoverflow.com/questions/3446429/how-to-put-a-usercontrol-into-visual-studio-toolbox) there's an answer that says this should just work. Another answer states your control needs to have a parameterless constructor. – CodeCaster Nov 30 '12 at 15:36

1 Answers1

1

If you have types in your main project that the custom control needs, the best practice is to split those types into their own project, and reference that project from both the main and custom control projects. Granted, this may be overkill :)

Before you can add custom controls to the toolbox, the project they're in must have been built successfully.

prprcupofcoffee
  • 2,950
  • 16
  • 20