ExceptionMessageBox Class
Displays a message box that can be customized with text, buttons, and symbols to improve the customer experience with a Microsoft Windows .NET Framework-based application.
Namespace: Microsoft.SqlServer.MessageBox
Assembly: Microsoft.ExceptionMessageBox (in microsoft.exceptionmessagebox.dll)
Assembly: Microsoft.ExceptionMessageBox (in microsoft.exceptionmessagebox.dll)
This example displays the message box with an OK button.
try { // Do something that may generate an exception. throw new ApplicationException("An error has occured"); } catch (ApplicationException ex) { // Define a new top-level error message. string str = "The action failed."; // Add the new top-level message to the handled exception. ApplicationException exTop = new ApplicationException(str, ex); exTop.Source = this.Text; // Show an exception message box with an OK button (the default). ExceptionMessageBox box = new ExceptionMessageBox(exTop); box.Show(this); }
This example uses the exception message box to show additional information that is helpful when troubleshooting or debugging.
try { // Do something that you don't expect to generate an exception. throw new ApplicationException("Failed to connect to the server."); } catch (ApplicationException ex) { string str = "An unexpected error occurred. Please call Helpdesk."; ApplicationException exTop = new ApplicationException(str, ex); exTop.Source = this.Text; // Information in the Data property of an exception that has a name // beginning with "HelpLink.Advanced" is shown when the user // clicks the Advanced Information button of the exception message // box dialog box. exTop.Data.Add("AdvancedInformation.FileName", "application.dll"); exTop.Data.Add("AdvancedInformation.FilePosition", "line 355"); exTop.Data.Add("AdvancedInformation.UserContext", "single user mode"); // Show the exception message box with additional information that // is helpful when a user calls technical support. ExceptionMessageBox box = new ExceptionMessageBox(exTop); box.Show(this); }
Development Platforms
For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.Target Platforms
For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.