c# - Event handler when Application bugs -
what event can handle when application shuts down due bug ?
thanks
update : point want excute code in case of bug due unhandled exception in whole application.
you can put exception handler around application.run
:
using system; using system.windows.forms; namespace testapp { static class program { [stathread] static void main() { try { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); application.run(new mainform()); } catch (exception exception) { messagebox.show( exception.message + exception.stacktrace, "error", messageboxbuttons.ok, messageboxicon.error ); } } } }
however, wouldn't leave in production app.
Comments
Post a Comment