Share via


ErrObject Module (Visual Basic)

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

Remarks

The ErrObject module supports the Err object. For more information, see Err Object (Visual Basic).

Members

Clear

Description

Erl

GetException

HelpContext

HelpFile

LastDLLError

Number

Raise

Source

 

 

Example

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

See Also

Reference

Err Object (Visual Basic)

Conversion Summary

Keywords and Members by Task

Visual Basic Language Keywords

Visual Basic Run-Time Library Members

Keywords Compared in Different Languages