Occurs when the control is entered.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
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 ContainerControl.ActiveControl property to the current form, focus events occur in the following order:
When you change the focus by using the mouse or by calling the Focus method, focus events occur in the following order:
The Leave events are suppressed by the Form class. The equivalent events in the Form class are the Activated and Deactivate events. The and Leave events are hierarchical and will cascade up and down the parent chain until the appropriate control is reached. For example, assume you have a Form with two GroupBox controls, and each GroupBox control has one TextBox control. When the caret is moved from one TextBox to the other, the Leave event is raised for the TextBox and GroupBox, and the event is raised for the other GroupBox and TextBox.and
Do not attempt to set focus from within the GotFocus, Leave, LostFocus, Validating, or Validated event handlers. Doing so can cause your application or the operating system to stop responding. For more information, see the WM_KILLFOCUS topic in the "Keyboard Input Reference" section and the "Message Deadlocks" section of theAbout Messages and Message Queuestopic.,
For more information about handling events, see Handling and Raising Events.
Available since 1.1