tags:

views:

91

answers:

2

Hi all, Is it possible to handle exceptions on the AppDomain.CurrentDomain.UnhandledException callback? I want to do the following:

  • Show my own "an exception has occured" dialog, with a "Send Report" button
  • After the user dismissed the box, I want to close my app, but I do not want to Windows default crash dialog "The application needs to close" box to show up.

Can this be done?

+1  A: 

You could to use Application.SetUnhandledExceptionMode method.

Please, take also a look here: User Friendly Exception Handling.

Rubens Farias
+1  A: 

Hope this link helps:

http://www.switchonthecode.com/tutorials/csharp-tutorial-dealing-with-unhandled-exceptions

As the code shows, just listen to the exception and do what you want when it happens.

Pedro