Click here to Skip to main content
14,969,910 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

I am new to 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 window application?

1 solution

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[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900