Visual Basic Language Reference  

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 .NET throws are Error objects. Visual Basic .NET can generate custom errors of any data type, including Error objects, by using the Throw statement. A program can display the error number and message of a caught Error 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.

To get help for a particular error message

  1. Click Search on the Help menu.
  2. Type the error message in the Look for box in the Search window.
    Note   Some error messages include words in single quotes 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

Visual Basic Compiler Errors | Try...Catch...Finally Statements | Structured Exception Handling