1. Home
  2. Computing & Technology
  3. Visual Basic

Chapter 9 - Structured Error Handling

By , About.com Guide

2 of 10

Exceptions to the Book! - A typo - And a more significant 'exception'

Before you start trying out the code examples in the book, a couple of clarifications might help.

First, there is a typo on page 237. "Check When" should be "Catch When" in Step 4. Second, the excellent VB.NET autocompletion feature will automatically code the Try ... Catch like this (as you will see as soon as you code the keyword Try):

~~~~~~~~~~~~~~~~~~~~~~~~~
Try

Catch ex As Exception

End Try
~~~~~~~~~~~~~~~~~~~~~~~~~

The book doesn't directly mention the As Exception clause anywhere. To duplicate the code in the book, just delete As Exception from the statement and everything works. Since both As Exception and the book's choice, When Condition are optional, it wouldn't be important except for one thing. Nearly all of the Microsoft documentation emphasizes As Exception and the book's choice is barely mentioned. So, to match the coding that Microsoft recommends and documents, let's look at it now. (It seems unusual that an MS Press book would not be in line with the Microsoft documentation. Go figure.)

Explore Visual Basic
By Category
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Learn VB.NET
  5. Trapping Errors Using Structured Error Handling

©2009 About.com, a part of The New York Times Company.

All rights reserved.