Export (0) Print
Expand All

10.10.2.2 On Error Statement

Visual Studio .NET 2003

An On Error statement modifies the most recent exception-handling state. It may be used in one of four ways:

  • On Error GoTo -1 resets the most recent exception to Nothing.
  • On Error GoTo 0 resets the most recent exception-handler location to Nothing.
  • On Error GoTo LabelName establishes the label as the most recent exception-handler location.
  • On Error Resume Next, establishes the Resume Next behavior as the most recent exception-handler location.
OnErrorStatement ::= On Error ErrorClause StatementTerminator
ErrorClause ::=
   GoTo - 1 |
   GoTo 0 |
   GotoStatement |
   Resume Next

See Also

10.10.2.1 Error Statement | 10.10.2.3 Resume Statement | 10.10.2 Unstructured Exception-Handling Statements | On Error Statement (Visual Basic Language Reference) | Unstructured Exception Handling (Visual Basic Language Concepts)

Show:
© 2014 Microsoft