Throw Statement
Collapse the table of content
Expand the table of content Throw Statement

Visual Studio .NET 2003

The Throw statement raises an exception, which is represented by an instance of a type derived from System.Exception. If the expression is not classified as a value or is not a type derived from System.Exception, then a compile-time error occurs. If the expression evaluates to a null reference at run time, then a System.NullReferenceException exception is raised instead.

A Throw statement may omit the expression within a catch block of a Try statement. In that case, the statement rethrows the exception currently being handled within the catch block.

ThrowStatement ::= Throw [ Expression ] StatementTerminator

See Also Finally Blocks | 10.10.1 Structured Exception-Handling Statements | Try...Catch Statements (Visual Basic Language Concepts)

© 2015 Microsoft