I am creating a windows application that does not have any forms. It is supposed to run in the background as scheduled. How can I manage all unhandled exception (as you would using Application_Error in ASP .NET) if my code is in a class file I read some places how to do it in the code behind for a form. but it doesn't seem to work in my situation. Help would be greatly appreciated.

Unhandled Exception Handler without form
MikeFesta
Drickus
try
'all of your code goes here
catch ex as exception
'do whatever you want with the exceptions
finally
'tuff you want it do do no matter if there is an exception or not
'end try
'whatever is underneath the try catch fail, will continue to work, but whatever is in the try might not if there is an error