vb.net - Make error window -
vb.net - Make error window -
i want create edition error study form instead default error window.
how can create edition form error report?
for example:
so want phone call custom handler when exception happens? no problem, define these 3 magic lines in origin of programme (as first lines of sub main
):
addhandler application.threadexception, addressof generichandler application.setunhandledexceptionmode(unhandledexceptionmode.catchexception) addhandler appdomain.currentdomain.unhandledexception, addressof unhandledhandler
then define generichandler , unhandledhandler, phone call custom form.
here sample implementation of both handlers:
public shared sub generichandler(byval sender object, byval args threading.threadexceptioneventargs) reportexception(args.exception) end sub public shared sub unhandledhandler(byval sender object, byval args unhandledexceptioneventargs) if not debugger.isattached reportexception(args.exceptionobject) end end if public shared sub reportexception(byval ex system.exception) msgbox(ex.tostring, msgboxstyle.okonly or msgboxstyle.exclamation, "unhandled exception - please contact support") 'you can farther improve add together custom logging etc. end sub
vb.net
Comments
Post a Comment