HtmlElementErrorEventArgs.Handled プロパティ

定義

このエラーが、ドキュメントをホストしているアプリケーションによって処理されたかどうかを取得または設定します。

public:
 property bool Handled { bool get(); void set(bool value); };
public bool Handled { get; set; }
member this.Handled : bool with get, set
Public Property Handled As Boolean

プロパティ値

イベントが処理済みである場合は true。それ以外の場合は false。 既定値は、false です。

次のコード例は、スクリプト エラーを抑制し、独自のカスタム ダイアログ ボックスを表示する方法を示しています。 このコード例では、アプリケーションで という名前webBrowser1のコントロールをホストするWebBrowser必要があります。

private void SuppressScriptErrors()
{
    if (webBrowser1.Document != null)
    {
        webBrowser1.Document.Window.Error += new HtmlElementErrorEventHandler(scriptWindow_Error);
    }
}

private void  scriptWindow_Error(object sender, HtmlElementErrorEventArgs e)
{
    MessageBox.Show("Suppressed error!");
    e.Handled = true;
}
Dim WithEvents ScriptWindow As HtmlWindow

Private Sub SuppressScriptErrors()
    If (WebBrowser1.Document IsNot Nothing) Then
        ScriptWindow = WebBrowser1.Document.Window
    End If
End Sub

Private Sub ScriptWindow_Error(ByVal sender As Object, ByVal e As HtmlElementErrorEventArgs) Handles ScriptWindow.Error
    MessageBox.Show("Suppressed error!")
    e.Handled = True
End Sub

注釈

ユーザーに true 独自のカスタム エラー メッセージを表示する場合、またはエラーを完全に抑制する場合は、このプロパティを に設定します。

適用対象