Effective Error Handling

While working with classes in VB 4.0, we found that the errors raised from our classes were not being trapped at the form level. We used “On Error Resume Next,” but still the error was being raised in the class module. We changed the settings of the Advanced Tab from Options in the Tools menu to “Break Unhandled Error,” and it worked as we needed.So, if you want to raise an error from a class module in your application to the form, you must use the Err.Raise method to raise the error. The error will be handled in the form only if you set the option from Options in the Tools menu in the Advanced Tab to “Break On Unhandled Error.” Otherwise, the error is raised in the class itself because the default setting is “Break On Class Module.”

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: