Refer to the event Application.ThreadExceptionto display your own error messages.
You can intercept the event at the top of the main method as follows:
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
And then you need the Handler method:
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
MessageBox.Show(e.Exception.ToString());
}
: AppDomain.UnhandledException, ThreadException.