Share via


WizardForm.OnLoad(EventArgs) Method

Definition

Indicates that the wizard form is loaded, and raises the Load event.

protected:
 override void OnLoad(EventArgs ^ e);
protected override void OnLoad (EventArgs e);
override this.OnLoad : EventArgs -> unit
Protected Overrides Sub OnLoad (e As EventArgs)

Parameters

e
EventArgs

A EventArgs that contains the event data.

Examples

The following example demonstrates the OnLoad method. In this example, the OnLoad method sets a text box to the user name. This code example is part of a larger example provided for the WizardForm class.

// Customize the OnLoad method, with the user's name.
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    Controls[0].Controls["_pageContainer"].
        Controls["demoModuleWizardLoginPage"].
        Controls["textBox1"].Text =
        System.Environment.UserName;
}
// Customize the OnLoad method, with the user's name.
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    Controls[0].Controls["_pageContainer"].
        Controls["demoModuleWizardLoginPage"].
        Controls["textBox1"].Text =
        System.Environment.UserName;
}

Remarks

If implemented in your code, this method is called when the wizard form is loaded. This method enables you to create a custom OnLoad method.

In this custom method, you should call the base.OnLoad(e) method to load the wizard pages. If both the OnInitialActivated and OnLoad methods are implemented, the OnLoad method occurs first.

Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

The OnLoad method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

Notes to Inheritors

When overriding OnLoad(EventArgs) in a derived class, be sure to call the base class’s OnLoad(EventArgs) method so that registered delegates receive the event.

Applies to