System.Windows.Forms.UserControl.Load Event

Occurs before the control becomes visible for the first time.

Syntax

public event EventHandler Load

Remarks

You can use this event to perform tasks such as allocating resources used by the control.

Note:

If the System.Windows.Forms.UserControl is part of an MDI child form, the UserControl.Load event will occur each time the child form is shown. In this case, you should put any one-time initialization code in the UserControl.#ctor instead of a UserControl.Load event handler.

Note:

The UserControl.Load event occurs when the handle for the System.Windows.Forms.UserControl is created. In some circumstances, this can cause the UserControl.Load event to occur more than one time. For example, the UserControl.Load event occurs when the System.Windows.Forms.UserControl is loaded, and again if the handle is recreated. (One way that a handle is recreated is by calling the Control.RecreateHandle method.) To account for the UserControl.Load event occurring more than one time, you should put any one time initialization code in the UserControl.#ctor constructor instead of a UserControl.Load event handler. In addition, you should not add data bindings to the System.Windows.Forms.UserControl in a UserControl.Load event handler.

For more information about handling events, see [<topic://cpconEventsOverview>].

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0