Application Development Using Visual Basic® and .NET
by Robert J. Oberg, Peter Thorsteinson, Dana L. Wyatt
Exceptions
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access