Sponsored By Aspose - File Format APIs for .NET

Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!

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!

[tags:windows forms,lifecycle events] 

This entry was posted in Windows Forms. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

7 Responses to Windows Forms – Basic events in the Lifecycle of Forms and Controls

  1. Bhushan Shende says:

    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! :-)

  2. Siddharth Joshi says:

    This is really a time saver.

  3. mike2008 says:

    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?

  4. Jose Rodriguez says:

    Thank you Paul,

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

  5. Arun Jose says:

    It is nice to know the control life cycle when developing custom controls..
    Thanks for the post,
    Arun Jose

  6. Derek says:

    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.

  7. murty says:

    it’s really good. thanks a lot for giving this valuable data.

Leave a Reply