
270
|
Chapter 12: The Language Reference
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
Usage at a Glance
• The Err object is not a collection; it contains information about only the most
recent error, if one occurred.
• For a full description of error handling in Visual Basic, see Chapter 11.
See Also
Erl Property, Err.Description Property, Err.HelpContext Property, Err.HelpFile Prop-
erty, Err.Number Property, Err.Source Property
Err.Clear Method
Class
Microsoft.VisualBasic.ErrObject
Syntax
Err.Clear( )
Description
The Clear method explicitly resets all the properties of the Err object after an error has
been handled.
Usage at a Glance
• Use the Clear method at your convenience when you want to make sure that an
error contained in the
Err object is truly a new error and not a leftover error from
an earlier block of code.
• The
Err object is automatically reset when any Resume, On Error,orExit state-
ment is executed.
Example
On Error Resume Next
Err.Clear( )
Call ErrorProneRoutineWithNoHandler( )
If (Err.Number <> 0) Then
' ----- The generated error must have come from the
' subroutine call, since the Clear( ) method
' set Err.Number to 0.
MsgBox ("The Error : " & Err.Description & vbCrLf _
& " was generated in " & Err.Source & ".")
End If
HelpFile Property * The path to an online help file, related to the active error.
LastDLLError Property * ...