Introducing Exceptions

In development environments different than .NET, programming languages can handle errors occurring during the application execution in different ways. For example, the Windows native APIs return a 32-bit HRESULT number in case an error occurs. Visual Basic 6 uses the On Error statements, whereas other languages have their own error-handling infrastructure. As you can imagine, such differences cannot be allowed in the .NET Framework because all languages rely on the Common Language Runtime, so all of them must intercept and handle errors the same way. With that said, the .NET Framework identifies errors as exceptions. An exception is an instance of the System.Exception class (or of a class derived from it) and provides ...

Get Visual Basic® 2010 Unleashed 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.