ErrObject Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The ErrObject
module contains properties and procedures used to identify and handle run-time errors using the Err
object.
public ref class ErrObject sealed
public sealed class ErrObject
type ErrObject = class
Public NotInheritable Class ErrObject
- Inheritance
-
ErrObject
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) & " was generated by " _
& Err.Source & ControlChars.CrLf & Err.Description
MsgBox(Msg, MsgBoxStyle.Information, "Error")
End If
Remarks
The ErrObject
module supports the Err
object. For more information, see Err.
Properties
Description |
Returns or sets a |
Erl |
Gets an integer indicating the line number of the last executed statement. |
HelpContext |
Returns or sets an |
HelpFile |
Returns or sets a |
LastDllError |
Gets a system error code produced by a call to a dynamic-link library (DLL). |
Number |
Returns or sets a numeric value specifying an error. Read/write. |
Source |
Returns or sets a |
Methods
Clear() |
Clears all property settings of the |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetException() |
Returns the exception representing the error that occurred. |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
Raise(Int32, Object, Object, Object, Object) |
Generates a run-time error; can be used instead of the |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |