Export (0) Print
Expand All

Order of Events in Windows Forms 

The order in which events are raised in Windows Forms applications is of particular interest to developers concerned with handling each of these events in turn. When a situation calls for meticulous handling of events, such as when you are redrawing parts of the form, an awareness of the precise order in which events are raised at run time is necessary. This topic provides some details on the order of events during several important stages in the lifetime of applications and controls. For specific details about the order of mouse input events, see Mouse Events in Windows Forms. For an overview of events in Windows Forms, see Events Overview (Windows Forms). For details about the makeup of event handlers, see Event Handlers Overview (Windows Forms).

Application Startup and Shutdown Events

Focus and Validation Events

When you change the focus by using the keyboard (TAB, SHIFT+TAB, and so on), by calling the Select or SelectNextControl methods, or by setting the P:System.Windows.Forms.ContainerControl.ActiveControl property to the current form, focus events of the Control class occur in the following order:

When you change the focus by using the mouse or by calling the Focus method, focus events of the Control class occur in the following order:

  • Enter

  • GotFocus

  • LostFocus

  • Leave

  • Validating

  • Validated

See Also

Community Additions

ADD
Show:
© 2014 Microsoft