Compartilhar via


How to: Get Information about Visual Basic Run-Time Errors 

Visual Basic run-time errors occur when an application attempts to perform an action that the system cannot execute.

The errors that Visual Basic throws are Exception objects. Visual Basic can generate custom errors of any data type, including Exception objects, by using the Throw statement. A program can display the error number and message of a caught exception to identify the error. If an error is not caught, the program ends.

Run-time errors can be trapped and examined by the code. By enclosing the code that produces the error in a Try block, any thrown error can be caught within a matching Catch block.

Getting Help

To get help for a particular error message

  1. Click Search on the Help menu.

  2. Type the error message in the Search For box in the Search window.

    Note

    Some error messages include words in single quotation marks that refer to identifiers from the code, such as a project or variable name, and are not part of the error message. Do not include the quoted words as part of your search.

See Also

Tasks

How to: Get Information about Visual Basic Compiler Errors
How to: Correct Run-Time Errors with the Exception Assistant

Reference

Try...Catch...Finally Statement (Visual Basic)

Concepts

Structured Exception Handling Overview for Visual Basic