I have a WPF form with a couple of buttons, and for each button I have error handling code:
try {bla bla} catch(Exception e){ more bla }
You can subscribe to AppDomain.UnhandledException event (see MSDN) to accomplish this. Ideally, this happens when bootstrapping your application. You can find the AppDomain you're executing in via AppDomain.Current.
AppDomain.UnhandledException
AppDomain.Current