ControlAdapter.OnUnload(EventArgs) Method


Overrides the OnUnload(EventArgs) method for the associated control.

protected public:
 virtual void OnUnload(EventArgs ^ e);
protected internal virtual void OnUnload (EventArgs e);
abstract member OnUnload : EventArgs -> unit
override this.OnUnload : EventArgs -> unit
Protected Friend Overridable Sub OnUnload (e As EventArgs)



An EventArgs that contains the event data.


If there is an adapter attached to a Control object and the OnUnload method is overridden, the override method is called instead of the Control.OnUnload method.

Override the OnUnload method to do target-specific processing in the Unload stage of the control lifecycle. Typically, these are cleanup functions that precede disposition of the control.

Notes to Inheritors

When you inherit from the ControlAdapter class and the adapter overrides the OnUnload(EventArgs) method, the adapter must call the corresponding base class method, which in turn calls the OnUnload(EventArgs) method. If OnUnload(EventArgs) is not called, the Unload event will not be raised.

Applies to

See also