Error Handling

Element

Description

Erl function

Indicates the line number at which an error occurred

Err.Clear method

Clears the Err object

Err.Description property

Provides a textual description of an error

Err.GetException method

Returns the Exception object associated with the current error

Err.HelpContext property

Returns or sets the help file ID for the current error

Err.HelpFile property

Returns or sets the name and path of the help file containing information about the current error

Err.LastDLLError property

Returns the error number from an error raised by a system API DLL

Err.Number property

Returns or sets the current error code

Err.Raise method

Generates a user-defined error

Err.Source property

Returns or sets the source of an error

ErrorToString function

Converts an error number to the corresponding error message

Exception class

Base class for all exceptions

IsError function

Determines whether an object is an exception type

On Error statement

Enables or disables an error handler

Resume statement

Transfers control from an error handler

Throw statement

Throws an exception

Try...Catch...Finally statement

Handles particular errors that may occur in a block of code through structured exception handling

Get VB.NET Language in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.