An inevitable part of programming is dealing with error conditions of various sorts. This section introduces the exception-handling mechanism of VB.NET, beginning with a discussion of the fundamentals of error processing and various alternatives that are available. We then carefully go through the VB.NET exception mechanism, which includes a Try block, Catch handlers, and a Finally block. You can raise exceptions by means of a Throw statement. The .NET class library provides an Exception class, which you can use to pass information about an exception that occurred. To further specify your exception and to pass additional information, you can derive your own class from Exception. When handling an exception, you may want to throw a new ...

Get Application Development Using Visual Basic® and .NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.