↑ Grab this Headline Animator

Friday, May 23, 2008

On Error Statement in VB

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.
Without an On Error statement, any run-time error that occurs is fatal: an error message is displayed, and execution stops.

GoTo line
Enables the error-handling routine that starts at the line specified in the required line argument. The line argument is any line label or line number. If a run-time error occurs, control branches to the specified line, making the error handler active. The specified line must be in the same procedure as the On Error statement, or a compile-time error will occur.
GoTo 0
Disables enabled error handler in the current procedure and resets it to Nothing.
GoTo -1
Disables enabled exception in the current procedure and resets it to Nothing.
Resume Next
Specifies that when a run-time error occurs, control goes to the statement immediately following the statement where the error occurred, and execution continues from that point. Use this form rather than On Error GoTo when accessing objects.

Submit this story to DotNetKicks

No comments:

Post a Comment

Post your comments/questions/feedback for this Article.


Latest Articles