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
|
|
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
Visual Basic Language Keywords