VB Exceptions
Exceptions are relatively new to VB; therefore, many VB programmers will take a little while to get used to the syntax and the idea behind exceptions. VB's On Error GoTo XXX resembles current exception handling.
Basic VB Exceptions
Listings 15.15 and 15.16 illustrate the basics of VB exception handling. This code sample follows the form of the VC++ sample shown earlier in that an ExceptionGenerator throws or causes various exceptions based on an integer selector that is passed as an argument. This sample illustrates a custom exception, a divide-by-zero exception, a stack overflow exception, and a FileNotFoundException. The full source for this sample can be found in the VBExceptions\BasicExceptions directory. Listing 15.15 shows ...
Get .NET Common Language Runtime 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.