Resume Statement
Visual Studio 2008
Resumes execution after an error-handling routine is finished.
Resume [ Next | line ]
This example uses the Resume statement to end error handling in a procedure and then resume execution with the statement that caused the error. Error number 55 is generated to illustrate use of the Resume statement.
Sub ResumeStatementDemo() On Error GoTo ErrorHandler ' Enable error-handling routine. Dim x As Integer = 32 Dim y As Integer = 0 Dim z As Integer z = x / y ' Creates a divide by zero error Exit Sub ' Exit Sub to avoid error handler. ErrorHandler: ' Error-handling routine. Select Case Err.Number ' Evaluate error number. Case 6 ' "Divide by zero" error. y = 1 ' Sets the value of y to 1 and tries the calculation again. Case Else ' Handle other situations here.... End Select Resume ' Resume execution at same line ' that caused the error. End Sub
Namespace: Microsoft.VisualBasic
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)