Exception Handling Tasks
Visual Basic supports both structured and unstructured exception (error) handling. By placing specific exception handling code in your application, you can handle most of the errors users may encounter. Use structured and unstructured exception handling to prevent potential errors from interfering with your application.
In This Section
How to: Catch an Exception in Visual Basic
Demonstrates how to use a Try…Catch block to catch an exception.How to: Throw an Exception in Visual Basic
Demonstrates how to use the Throw statement to throw an exception.How to: Implement I/O Try...Catch Blocks in Visual Basic
Demonstrates how to use a Try…Catch block to test an input or output operation.How to: Test Code with a Try…Catch Block in Visual Basic
Demonstrates how to use a Try…Catch block to test a section of code.How to: Clean up Resources with a Try…Finally Block in Visual Basic
Demonstrates how to use a Try…Catch…Finally block to clean up resources used by code.How to: Filter Errors in a Catch Block in Visual Basic
Demonstrates how to filter for specific types of errors within a Try…Catch block.How to: Display an Exception's Message in Visual Basic
Demonstrates how to retrieve the string associated with an error message.How to: Create New Exception Classes in Visual Basic
Demonstrates how to create a new exception class.How to: Check an Exception's Inner Exception
Demonstrates how to determine the original exception through looking at an exception's InnerException property.
Reference
Throw Statement (Visual Basic)
Describes the Throw statement and how it is used.Try...Catch...Finally Statement (Visual Basic)
Describes the Try, Catch, and Finally statements and how they are used.