Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2008

Tip: Looking for answers? Try searching our database.

UserControls?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
daniel.divita@gmail.com - 21 Feb 2008 15:37 GMT
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
Jack Jackson - 21 Feb 2008 16:33 GMT
>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
[quoted text clipped - 7 lines]
>
>Daniel

You can build the UserControl in the same project.  Once you build the
project with the UserControl in it, the control should appear in the
ToolBox, or it may be necessary to close and reopen the project.
daniel.divita@gmail.com - 21 Feb 2008 18:14 GMT
> On Thu, 21 Feb 2008 07:37:24 -0800 (PST), daniel.div...@gmail.com
> wrote:
[quoted text clipped - 14 lines]
> project with the UserControl in it, the control should appear in the
> ToolBox, or it may be necessary to close and reopen the project.

I just saw that! Thanks so much!!!

Daniel
Bob Powell [MVP] - 21 Feb 2008 21:25 GMT
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.

Signature

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.

> 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
[quoted text clipped - 7 lines]
>
> Daniel

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.