The following code uses the Throw statement to throw an exception: ' Throws a new exception. You can access the call stack for the exception through the StackTrace property. If expression is not provided, the call stack is left unchanged. The Throw statement resets the call stack for the expression exception. You can use the Throw statement to trap errors within your code because Visual Basic moves up the call stack until it finds the appropriate exception-handling code.Ī Throw statement with no expression can only be used in a Catch statement, in which case the statement rethrows the exception currently being handled by the Catch statement. Finally) or unstructured exception-handling code ( On Error GoTo). The Throw statement throws an exception that you can handle with structured exception-handling code ( Try. Optional when residing in a Catch statement, otherwise required. Provides information about the exception to be thrown.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |