Paul Laudeman

Sponsors

The Lounge

News

  • I'm test-driven!
    TestDriven.NET

    MSN Messenger: plaudeman at hotmail dot com

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Windows Forms - Basic events in the Lifecycle of Forms and Controls

Recently, a community member posted a question to the WindowsForms.NET site forums asking about the basic events that are fired in Forms and User Controls in Windows Forms applications. After digging through the MSDN documentation and various other sources (amazingly, it doesn't seem like the complete list is documented in any one place), I came up with the following:

Form Events:

  • Construtor
  • Load
  • Layout
  • Activated
  • Paint­
  • Closing
  • Closed
  • Deactivate
  • Dispose

and for Controls:

  • Enter 
  • GotFocus 
  • Leave 
  • Validating 
  • Validated 
  • LostFocus

I also discovered a code sample called EventSpy written by Urs Eichmann that you can use to view and filter the events to see in real time to see how your application is behaving. This is really helpful to use as you can see which events are fired and in what order as your application runs. Very cool!

Technorati Tags: ,  


Posted 04-17-2005 6:19 PM by paul.laudeman
Filed under:

[Advertisement]

Comments

Yitzhak Gootvilig's Blog wrote Windows Forms - Basic events in the Lifecycle of Forms and Controls
on 04-18-2005 5:53 AM
.Net Adventures wrote EventSpy by Urs Eichmann
on 04-18-2005 12:59 PM
murty wrote re: Windows Forms - Basic events in the Lifecycle of Forms and Controls
on 07-10-2006 7:10 AM
it's really good. thanks a lot for giving this valuable data.
Derek wrote re: Windows Forms - Basic events in the Lifecycle of Forms and Controls
on 03-11-2007 2:42 PM

This was one of the most useful articles I have ever read. Thanks for your effort in compiling these events. You have saved me a tremendous amount of time.

Arun Jose wrote re: Windows Forms - Basic events in the Lifecycle of Forms and Controls
on 07-17-2007 9:55 AM

It is nice to know the control life cycle when developing custom controls..

Thanks for the post,

Arun Jose

Jose Rodriguez wrote re: Windows Forms - Basic events in the Lifecycle of Forms and Controls
on 03-26-2008 4:07 AM

Thank you Paul,

A great job really. You gift me a lot of free time.

Windows Form Life Cycle « Maverick wrote Windows Form Life Cycle « Maverick
on 09-24-2008 7:52 AM

Pingback from  Windows Form Life Cycle « Maverick

mike2008 wrote re: Windows Forms - Basic events in the Lifecycle of Forms and Controls
on 11-25-2008 12:14 PM

is there any equivalent events on Control class for Closing and Closed?

what is the best event to hook just before a Control is being disposed?

Siddharth Joshi wrote re: Windows Forms - Basic events in the Lifecycle of Forms and Controls
on 01-05-2009 5:35 AM

This is really a time saver.

Bhushan Shende wrote re: Windows Forms - Basic events in the Lifecycle of Forms and Controls
on 03-06-2009 12:50 PM

Thank you very much and was precisely looking for this info! Thanks again!! Anyways i wonder it comes under title Application model and i was searching google whole way to find none!! Don't ask hw i came here!! Even i dunno!! :-)

Have a good day! :-)