Use the Application.ThreadException() to set up a new handler. You can also use the Application.SetUnhandledExceptionMode() to set up a handler as well.
Of course you should have try{}...catch{} around sections of code and not only rely on these global error handlers.
Good luck!
>>>>>>>>Can someone help me with catching an exception on a form in c#? For instance, a button click causes an error, I want a base error handler layer to catch it (I do not want to put try{}...catch{} in every button on a form.
>>>>>>>This has nothing to do with my main(); there isn't a specific problem either.
>>>>>>>>I just want to put my own error handler in place of the default Visual Studio's popup window (which has the Details, Continue and Quit buttons).
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement