You are here:About>Computing & Technology>Visual Basic> Learn VB.NET> Trapping Errors Using Structured Error Handling
About.comVisual Basic
Newsletters & RSSEmail to a friendSubmit to Digg

Chapter 9 - Structured Error Handling

From Dan Mabbutt,
Your Guide to Visual Basic.
FREE Newsletter. Sign Up Now!

Structure FINALLY comes to VB Error Handling!

Structured Error Handling
Structured Error Handling
Previous | Next >>

If the old coder's saying is true: "Good programmers write good code but great programmers steal great code." ... then Microsoft has done a really 'great' job in adding a new way to handle runtime errors in VB.NET! That is, it's new to VB.NET. The whole idea was pioneered and perfected in languages like C++ and Java. VB.NET has taken the 'best of the best' and made it part of the language. And it works.

Chapter 9 shows you the new, old way to do the job right!

Like real estate, there are three things that are most important about coding structured error handling in VB.NET.

  1. Location
  2. Location
  3. Location

In other words, the first thing to think about is where to put the error trapping in your code. Once you decide that, then you write the error handling code to intercept the errors and minimize the effect of bad things happening in your program. Where are those critical locations? Look for the situations listed in the table at the bottom of page 227. The rest of Chapter 9 tells you how to actually write the error handling code.

If you're interested in the official Microsoft "tutorial" on this topic, you can find it at the MSDN site here.

  1. Structure FINALLY comes to VB Error Handling!
  2. Exceptions to the Book! - A typo - And a more significant 'exception'
  3. Microsoft's Point of View
  4. The Difference in Code
  5. The Microsoft Way - Here's the Microsoft documentation method
  6. About the New Tricks
  7. What Could Go Wrong? - A Few Things That Might Be Confusing
  8. About the Error Messages
  9. Confusion in Disk Drive Error Handler ?
  10. Assignment For Next Time

Previous | Next >>

 All Topics | Email Article | | |
Advertising Info | News & Events | Work at About | SiteMap | Reprints | HelpOur Story | Be a Guide
User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2008 About, Inc., A part of The New York Times Company. All rights reserved.