Link to home
Start Free TrialLog in
Avatar of p_gauri7
p_gauri7

asked on

Capture form event after an unhandled exception

Hi,

I am developing an application in VB.NET and have come across this problem:

Sometimes the application throws an unhandled exception and when the user presses break OR continue on the dialog box, it closes the form (which is OK). In this scenario, I would like to capture an event of the form (i.e. before the form unloads) to set up a flag in the database. IF the application unloads normally, the flag is set in form_closed event- which is not fired in case of an exception. Is there any way to capture one event which (after the user responds to the dialog of unhandled exception) can be used to set the flag?

-Gauri

ASKER CERTIFIED SOLUTION
Avatar of fwploeg
fwploeg
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of p_gauri7
p_gauri7

ASKER

Thanks  fwploeg. It worked perfect. Instead of adding a module and putting  a sub main(), I put the event handler code in the main form's load event.

Thanks again,
-Gauri