HtmlElementErrorEventArgs 类

定义

提供事件的数据 Error

public ref class HtmlElementErrorEventArgs sealed : EventArgs
public sealed class HtmlElementErrorEventArgs : EventArgs
type HtmlElementErrorEventArgs = class
    inherit EventArgs
Public NotInheritable Class HtmlElementErrorEventArgs
Inherits EventArgs
继承
HtmlElementErrorEventArgs

示例

下面的代码示例演示如何取消脚本错误并显示自己的自定义对话框。 此代码示例要求应用程序托管名为 /a0> 的 控件。

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

属性

名称 说明
Description

获取与错误对应的描述性字符串。

Handled

获取或设置承载文档的应用程序是否已处理此错误。

LineNumber

获取发生错误的 HTML 脚本代码行。

Url

获取生成错误的文档的位置。

方法

名称 说明
Equals(Object)

确定指定的对象是否等于当前对象。

(继承自 Object)
GetHashCode()

用作默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅