If a run-time error occur in a VB6 app, does this mean Error handling has been turned off by use of the On Error Goto 0 statement?
Can this assumption be made? Or are there other circumstances in which a run-time error could occur?
If an error has been handled by either a Resume Next or a Goto then surely a run-time error would not occur. True or False?
It occurs because there is no error handler within the executing code, including calling procedures. You cannot make the assumption that
On Error Goto 0was used.I am assuming you mean an unhandled run-time error. Since it is unhandled, your application “ends abnormally”.
Visual Basic Concepts, Error Handling Hierarchy, http://msdn.microsoft.com/en-us/library/aa241677(VS.60).aspx
False. Sometimes a run-time error will occur in the error handler. If your error handling logic misses this, you will get an unhandled run-time error.
More Information
Briefly, using
On Error Goto 0removes any error handler (disables or turns off) within the procedure until the procedure ends or you assign an error handler using one of theOn Errorstatements. User-Interface events with no error handling code will also have no error handler until you define one.Error Trapping
During debugging, you can specify “Error Trapping” which causes VBE to break “on-all-errors”, “in-class-module”, or “on-unhandled-errors”. During run-time, the behavior is “On Unhandled Errors” (A run-time error will occure if the Visual Basic Run-Time Library can find no error handler.). If you are troubleshooting / debugging, try setting “Error Trapping” to “Break on All Errors”. This will cause VBE to break at the point of the error, where you can start debugging or just contine execution.