C# MessageBox Error Messages

Posted by Jim Fell on Stack Overflow See other posts from Stack Overflow or by Jim Fell
Published on 2010-05-07T15:26:21Z Indexed on 2010/05/07 15:28 UTC
Read the original article Hit count: 272

Hello. In my application I am using message boxes to display error information.

try
{
   // Something...
}
catch (SystemException ex)
{
   MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

This was fine at first, but as my program grows it becomes increasingly difficult to find the try-catch block where this error is generated. Is there a way to display the line of code or function in which the error was generated? I am using Microsoft Visual C# 2008 Express Edition. Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about error-handling