Name

On Error Statement

Synopsis


On Error GoTo label|0|-1        Syntax 1.
On Error Resume Next            Syntax 2.
label Either label, 0, or -1 is required

A valid label within the subroutine

Description

Enables or disables error handling within a procedure.

If you don’t use an On Error statement or a Try...Catch block in your procedure, or if you have explicitly switched off error handling, the Visual Basic runtime engine will automatically handle the error. First, it will display a dialog box containing the standard text of the error message. Second, it will terminate the application. So any error that occurs in the procedure will produce a fatal runtime error.

Get VB.NET Language Pocket Reference 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.