O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Error Statement

Syntax

Error [errornumber]
errornumber (optional; Long)

Any valid error code

Description

Raises an error

Rules at a glance

The Error statement is included only for backward compatibility; instead, if you’re using standard Visual Basic error handling, you should use the Err.Raise method and the Err object. Otherwise, you should use structured exception handling with the Try...Catch construct.

Programming Tips and Gotchas

The Error statement has been a “compatibility” statement for several versions of Visual Basic. Interestingly, it managed to survive the general purge of outdated language elements. Despite its persistence, we still recommend that its use be strictly avoided.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required