Control.OnUnload(EventArgs) 方法

定義

引發 Unload 事件。

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

參數

e
EventArgs

包含事件資料的 EventArgs 物件。

範例

// Override the OnUnLoad method to set _text to
// a default value if it is null.
protected override void OnUnload(EventArgs e)
{
    base.OnUnload(e);
    if (_text == null)
        _text = "Here is some default text.";
}
' Override the OnUnLoad method to set _text to
' a default value if it is null.
Protected Overrides Sub OnUnload(ByVal e As EventArgs)
    MyBase.OnUnload(e)
    If _text Is Nothing Then
        _text = "Here is some default text."
    End If
End Sub

備註

ASP.NET 呼叫此方法來引發 Unload 事件。 如果您要開發自訂控制項,您可以覆寫這個方法,以提供額外的處理。 如果您覆寫此方法,請呼叫基底控制項 OnUnload 的 方法來通知事件的訂閱者。

適用於

另請參閱