HtmlElementErrorEventArgs HtmlElementErrorEventArgs HtmlElementErrorEventArgs HtmlElementErrorEventArgs Class


Error 事件提供数据。Provides data for the Error event.

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


下面的代码示例演示如何取消显示脚本错误并显示自己自定义对话框。The following code example demonstrates how to suppress a script error and display your own custom dialog box. 此代码示例需要您的应用程序主机WebBrowser名为控件webBrowser1This code example requires that your application host a WebBrowser control named webBrowser1.

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 Description Description Description

获取与错误对应的描述性字符串。Gets the descriptive string corresponding to the error.

Handled Handled Handled Handled

获取或设置此错误是否已由承载文档的应用程序处理。Gets or sets whether this error has been handled by the application hosting the document.

LineNumber LineNumber LineNumber LineNumber

获取发生错误的 HTML 脚本代码行。Gets the line of HTML script code on which the error occurred.

Url Url Url Url

获取生成错误的文档的位置。Gets the location of the document that generated the error.


Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)