应用程序级别的vb窗口应用程序中的错误处理 [英] Error Handling in vb window application at application level
本文介绍了应用程序级别的vb窗口应用程序中的错误处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我是vb.net和窗口应用的新手。
我是在应用程序级别处理错误。
我的问题是:在Web应用程序(ASP.Net)中,为了处理应用程序级别的错误,Global中有Application_Error事件。 asax文件。
我们可以在Application_Start()事件中处理(在db或其他东西中记录错误)。
同样,如何在vb.net窗口应用程序中实现同样的功能?
解决方案
我个人认为你应该处理异常在最早的机会 - 即不在应用程序级别。
我今天发现这篇文章,我建议阅读 .NET中的异常处理最佳实践 [ ^ ]
但是,您仍然可以捕获未处理的异常应用程序级别 - 请参阅 My.Application.UnhandledException事件 [ ^ ]
Hello,
I am new to vb.net and window application.
I am stuck at handling error at application level.
My question is: In web application(ASP.Net), to handle error at application level there is Application_Error event in Global.asax file.
we can handle(log error in db or other stuff) in Application_Start() event.
In same way, how can I achieve this same kind of functionality in vb.net window application?
解决方案
Personally I hold the view that you should handle exceptions at the earliest opportunity - i.e. not at the application level.
I found this article today which I would recommend reading Exception Handling Best Practices in .NET[^]
However, you can still capture unhandled exceptions at the application level - see My.Application.UnhandledException Event[^]
这篇关于应用程序级别的vb窗口应用程序中的错误处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文