Enables an error-handling routine and specifies the location of the routine within a procedure; can also be used to disable an error-handling routine.

On Error Statement (Visual Basic)

submited by
Style Pass
2021-05-22 23:30:03

Enables an error-handling routine and specifies the location of the routine within a procedure; can also be used to disable an error-handling routine. The On Error statement is used in unstructured error handling and can be used instead of structured exception handling. Structured exception handling is built into .NET, is generally more efficient, and so is recommended when handling runtime errors in your application.

Without error handling or exception handling, any run-time error that occurs is fatal: an error message is displayed, and execution stops.

We recommend that you use structured exception handling in your code whenever possible, rather than using unstructured exception handling and the On Error statement. For more information, see Try...Catch...Finally Statement.

An "enabled" error handler is one that is turned on by an On Error statement. An "active" error handler is an enabled handler that is in the process of handling an error.

Leave a Comment