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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.