SQL Workbench of SQL Server 2005 has a beautiful user interface. An interesting dialog for most of the developers in that user interface is Exception Message box.When ever an error occurs SQL Work bench shows that error with full information about the exception and a sample dialog box is shown below
If wish to use the same messagebox to show exceptions raised in your .NET application then you are lucky. Microsoft has exposed the message box class ExceptionMessageBox in the dll Microsoft.ExceptionMessageBox. The following is the sample code to demonstrate use of the exception message box
private void Form1_Load(object sender, EventArgs e)
{
try
{
int a, b, c;
//Set values
a = 10;
b = 0;
//Raise error
c = a / b;
}
catch (Exception exp)
{
ExceptionMessageBox objMsgBox;
objMsgBox = new ExceptionMessageBox(exp);
objMsgBox.Show(this);
}
}
1 Comment:
This Message Box is really excellent. But do you know how to localize the user interface?
Thanks in Advance, Alexandra
Post a Comment