Resume Statement


Resume Statement

Syntax

     Resume [Next | label] 


label (required)

A source code label that appears somewhere in the current procedure

Description

The Resume statement is used to continue program execution when an error-handling routine is complete. Resume can take any of the forms shown in the following list:


Resume

Program execution continues with the source-code line that caused the error. That line may be a call to another subroutine where the actual error occurred but that contained no error-handling code of its own.


Resume Next

Program execution continues with the source-code line immediately following the one that caused the error. The line that caused the error may be a call to another subroutine where the actual error occurred but that contained no error-handling code of its own; that line is still skipped, and the subroutine call is not repeated.


Resume label

Program execution continues at the specified label, which must appear in the same procedure as the error handler.

Usage at a Glance

  • You can only use the Resume statement in an error-handling section of code.

  • An error-handling section of code does not have to contain a Resume statement. That code may decide to exit the current routine altogether. In that case, it issues an Exit Sub or similar statement instead of a Resume statement.

Version Differences

VB 6 supported a "Resume 0" syntax that was identical to a plain "Resume" statement. The "Resume 0" syntax has been removed in .NET.

See Also

Err Object, On Error Statement




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net