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 / July 2006

Tip: Looking for answers? Try searching our database.

User control life cycle in VS2005 editor

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hiten - 06 Jul 2006 20:55 GMT
Hi,

Can someone tell me what is the user control life cycle when its dropped in
to a visual studio designer? I mean, I have a new windows application project
created in visual studio 2005 and a new form added. Now I create a new user
control extending it from UserControl. Add few properties in user control and
few events. Now when I drop this user control in form, i want to know what
designer does to display it on the form and what event's would be fired and
which events wouldn't fire .

Reason of asking such question is, I have a user control and when i drop it
on a form, it fires its load event and I was under impression, it would not
fire load event when control is in design mode. It must fire it when its in
RunMode. I do check DesignMode property but it seems like its not giving me
right value. Or do i have to implement any other interface with user control
to make DesignMode property work in right way?

Thanks,

Hiten
Jared Parsons [MSFT] - 07 Jul 2006 01:22 GMT
Hello Hiten,
> Reason of asking such question is, I have a user control and when i
> drop it on a form, it fires its load event and I was under impression,
[quoted text clipped - 3 lines]
> any other interface with user control to make DesignMode property work
> in right way?

The problem is the semantics around the DesignMode property.  It seems to
only refer to the component that is being designed (i.e. What is doubled
clicked on to open the designer).  Once you drop your control onto the form
it is no longer being designed.  

A lot of people have run into this issue and if you hit some search engines
you'll find a variety of sulotions.  My personal favorite is to implement
a custom property and add a conditional compilation setting (C#) or application
setting (VB) that I toggle to indicate design mode for the custom property.

--
Jared Parsons [MSFT]
jaredpar@online.microsoft.com
All opinions are my own. All content is provided "AS IS" with no warranties,
and confers no rights

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.