Error Handling: High Powered Reusable Error Handling Method in Visual Basic

High Powered Reusable Error Handling Method in Visual Basic

Error Handling in VB is sort of a pain in the ass but very important if you intend to distribute applications. Here is a very simple and effective error handling solution I use that works perfectly.

CREATE A .BAS MODULE AND NAME IT ErrHandler

In it insert the following code:

In  sub routines and functions insert the following Err Handler code at the top

At the bottom of every sub and function, below all the code, add

Now anytime there is an error you will be notified exactly where and when the error occurred and be able to deal with and correct it right away. Just get into the habit of pasting the above error handling code in most all of your subs and functions.