Bob
Thu Feb 21 15:25:38 CST 2008
If you create a user control in any project it is automatically added to
the toolbox for you once the program is compiled successfully for the
first time.
This has it's advantages and disadvantages. On the plus side, it's quick
and easy. On the minus side, a user-control with a bug in it can mess up
your life because it can throw an exception and your form will be
unusable until you remove the control. This in particular makes
debugging a user control a pain.
The "correct" method is to do as you have read and create it in a second
separate project that you will reference from your application. You can
also debug the user control if you need to using two instances of Visual
Studio.
See Windows Forms Tips and Tricks for some good information on that subject.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
daniel.divita@gmail.com wrote:
> I am a web developer by trade, but have done a little with winforms.
> How can I add a winforms user control to an application without having
> to create a separate project for each control? From what I have been
> reading, you need to create a project for the user control, build it,
> and then add it to the tool box. Once it is in the tool box you can
> drag it onto the form or other control. I want the user controls to be
> part of the base project and add them to the forms without having to
> build them each time I make a change. Can I modify the designer.vb
> file to do what I need?
>
> Daniel