Click here to Skip to main content
15,890,512 members
Home / Discussions / C#
   

C#

 
AnswerRe: question??? Pin
Christian Graus10-Jul-07 9:06
protectorChristian Graus10-Jul-07 9:06 
Questionjfo's Splitbutton... Pin
Faredegyn10-Jul-07 8:12
Faredegyn10-Jul-07 8:12 
QuestionRe: jfo's Splitbutton... Pin
Faredegyn11-Jul-07 3:24
Faredegyn11-Jul-07 3:24 
QuestionC# Having the Font resize accordingly with the label and the form it is in. Pin
Minosknight10-Jul-07 7:12
Minosknight10-Jul-07 7:12 
AnswerRe: C# Having the Font resize accordingly with the label and the form it is in. Pin
Christian Graus10-Jul-07 7:15
protectorChristian Graus10-Jul-07 7:15 
GeneralRe: C# Having the Font resize accordingly with the label and the form it is in. Pin
Minosknight10-Jul-07 7:18
Minosknight10-Jul-07 7:18 
GeneralRe: C# Having the Font resize accordingly with the label and the form it is in. Pin
Christian Graus10-Jul-07 7:32
protectorChristian Graus10-Jul-07 7:32 
QuestionHow to trap unhandled exceptions Pin
Glenn E. Lanier II10-Jul-07 6:45
Glenn E. Lanier II10-Jul-07 6:45 
Hi. I'm trying to catch all unhandled exceptions in my application (so they can be logged and the user presented with a "nice" message instead of some confusing "computer-y" message.

I do the following in my WinForm application:

-- In the constructor
// Create the unhandled exception handler
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += new UnhandledExceptionEventHandler(OverAllUnhandledHandler);

-- the method
static void OverAllUnhandledHandler(object sender, UnhandledExceptionEventArgs args) 
{
   Exception e = (Exception) args.ExceptionObject;
   logger.Log(LogLevel.Fatal, e.ToString());

   MessageBox.Show("Please check error logs for details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}


If I create a divide by zero error, it is trapped (either in the constructor or in a button click event. I have even created a thread that starts and causes the error; it is still trapped. However, some errors are still popping up in the standard "Microsoft .NET Framework" dialog, with the text "An unhandled exception has occurred in your application.....".

Any idea how to get all unhandled exceptions (I know, code better to catch all exceptions) to be caught by this OverAllUnhandledHandler method?

Thanks for any tips.

--G
AnswerRe: How to trap unhandled exceptions Pin
Christian Graus10-Jul-07 6:59
protectorChristian Graus10-Jul-07 6:59 
GeneralRe: How to trap unhandled exceptions Pin
Glenn E. Lanier II10-Jul-07 7:57
Glenn E. Lanier II10-Jul-07 7:57 
GeneralRe: How to trap unhandled exceptions Pin
Christian Graus10-Jul-07 8:11
protectorChristian Graus10-Jul-07 8:11 
GeneralRe: How to trap unhandled exceptions Pin
Glenn E. Lanier II10-Jul-07 10:14
Glenn E. Lanier II10-Jul-07 10:14 
AnswerRe: How to trap unhandled exceptions Pin
Daniel Grunwald10-Jul-07 8:17
Daniel Grunwald10-Jul-07 8:17 
GeneralRe: How to trap unhandled exceptions Pin
Glenn E. Lanier II10-Jul-07 10:16
Glenn E. Lanier II10-Jul-07 10:16 
QuestionDataGridView Pin
mehrdadc4810-Jul-07 6:45
mehrdadc4810-Jul-07 6:45 
AnswerRe: DataGridView Pin
rahvyn610-Jul-07 9:40
rahvyn610-Jul-07 9:40 
QuestionNewbie: Calling an overriden method from a child class... Pin
Phillip Hodges10-Jul-07 5:17
Phillip Hodges10-Jul-07 5:17 
AnswerRe: Newbie: Calling an overriden method from a child class... Pin
Colin Angus Mackay10-Jul-07 5:19
Colin Angus Mackay10-Jul-07 5:19 
GeneralRe: Newbie: Calling an overriden method from a child class... Pin
Phillip Hodges10-Jul-07 5:32
Phillip Hodges10-Jul-07 5:32 
AnswerRe: Newbie: Calling an overriden method from a child class... Pin
J4amieC10-Jul-07 5:32
J4amieC10-Jul-07 5:32 
QuestionCheckAll/Uncheck all Pin
kibromg10-Jul-07 4:56
kibromg10-Jul-07 4:56 
AnswerRe: CheckAll/Uncheck all Pin
Christian Graus10-Jul-07 4:57
protectorChristian Graus10-Jul-07 4:57 
GeneralRe: CheckAll/Uncheck all Pin
kibromg10-Jul-07 5:19
kibromg10-Jul-07 5:19 
GeneralRe: CheckAll/Uncheck all Pin
Christian Graus10-Jul-07 5:26
protectorChristian Graus10-Jul-07 5:26 
GeneralRe: CheckAll/Uncheck all Pin
kibromg10-Jul-07 5:35
kibromg10-Jul-07 5:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.