How to create global error handler in Windows Form Application?

前端 未结 3 1079
醉梦人生
醉梦人生 2021-02-09 15:09

I think there was a component that allowed to create global error handling.

For example I myself throw exception when something bad happens, for example

         


        
3条回答
  •  忘了有多久
    2021-02-09 15:38

    You can accomplish this either through AppDomain.UnhandledException or Application.ThreadException.

    See the documentation for more details on what these events do and what the difference is for these events. The idea is that AppDomain.UnhandledException always works. Application.ThreadException is specifically for unhandled UI exceptions.

提交回复
热议问题