Compartir a través de


ErrObject Class

Microsoft Silverlight will reach end of support after October 2021. Learn more.

The ErrObject module contains properties and procedures used to identify and handle run-time errors using the Err object.

Inheritance Hierarchy

System.Object
  Microsoft.VisualBasic.ErrObject

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

Syntax

'Declaration
Public NotInheritable Class ErrObject
public sealed class ErrObject

The ErrObject type exposes the following members.

Properties

  Name Description
Public property Description Returns or sets a String expression containing a descriptive string associated with an error. Read/write.
Public property Erl Returns an integer indicating the line number of the last executed statement. Read-only.
Public property Number Returns or sets a numeric value specifying an error. Read/write.

Top

Methods

  Name Description
Public method Clear Clears all property settings of the Err object.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public method GetException Returns the exception representing the error that occurred.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Raise Generates a run-time error; can be used instead of the Error statement.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Examples

This example uses the properties of the Err object in constructing an error-message dialog box. Notice what happens when you use the Clear method first: When you then generate a Visual Basic error with the Raise method, Visual Basic's default values become the properties of the Err object.

Dim Msg As String
' If an error occurs, construct an error message.
On Error Resume Next   ' Defer error handling.
Err.Clear
Err.Raise(6)   ' Generate an "Overflow" error.
' Check for error, then show message.
If Err.Number <> 0 Then
    Msg = "Error # " & Str(Err.Number) & vbCrLf & Err.Description
End If

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference