03-11-2002, 02:11 PM
OK. I know I've seen this here somewhere before, but I can't find it !!
I want to write an error handler, possibly using a module that I can include into any project.
Can anyone point me in the right direction please. ?
03-11-2002, 02:31 PM
Theres been millions of threads about this recently, searching the forum would be a great start.
03-11-2002, 02:33 PM
There are a couple of tutorials in the Tutor's Corner about debugging programs and error handling, you might want to check them out.
Before you add any error handling code, the first thing to do is to try to prevent an error. If you declare an integer rather than a string and get an error, it makes no sence to add error code; just change dimention.
The most basic of all error handling code is the On Error statement. Generally, you'll put it at the beginning of the sub or function.
03-11-2002, 02:47 PM
What Orufet just said is the way to do it.
Just as a further tip, you should make sure that your code works
perfectly without any error handling. I put error handles in my
code, BUT, I comment them out during testing.
03-11-2002, 03:12 PM
No, you cant make a standard module to drop into any project and then take over all the error handling. Dont know where you thought you saw that.
If you insist on this then the closest you can get is to rely on the fact that VB passes all errors up the calling chain. However, this is useless for event-based programs.