Bookshelf Home | Contents | Index | PDF |
Siebel VB Language Reference > VB Language Reference > Exit StatementThis standard VB statement terminates loop statements or transfers control to a calling procedure. SyntaxExit {Do | For | Function | Sub} ReturnsUsageUse Exit Do inside a Do...Loop statement. Use Exit For inside a For...Next statement. When the Exit statement is executed, control transfers to the statement after the Loop or Next statement. When used within a nested loop, an Exit statement moves control out of the immediately enclosing loop. Use Exit Function inside a Function...End Function procedure. Use Exit Sub inside a Sub...End Sub procedure. ExampleThis example uses the On Error statement to trap run-time errors. If there is an error, the program execution continues at the label "Debugger." The example uses the Exit statement to skip over the debugging code when there is no error. Sub Button_Click See AlsoDo...Loop Statement |
Siebel VB Language Reference |