Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

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.

System.Object
  Microsoft.SqlServer.MessageBox.ExceptionMessageBox

Namespace:  Microsoft.SqlServer.MessageBox
Assembly:  Microsoft.ExceptionMessageBox (in Microsoft.ExceptionMessageBox.dll)
[ComVisibleAttribute(false)]
public class ExceptionMessageBox

The ExceptionMessageBox type exposes the following members.

  NameDescription
Public methodExceptionMessageBox()Creates an instance of ExceptionMessageBox with the default properties.
Public methodExceptionMessageBox(Exception)Creates an instance of ExceptionMessageBox by using information from the specified Exception.
Public methodExceptionMessageBox(String)Creates an instance of ExceptionMessageBox with the supplied top-level error message text.
Public methodExceptionMessageBox(Exception, ExceptionMessageBoxButtons)Creates an instance of ExceptionMessageBox by using information from the specified Exception and by specifying the buttons to display in the message box.
Public methodExceptionMessageBox(String, String)Creates an instance of ExceptionMessageBox with the supplied top-level error message text and the dialog box caption of the exception message box.
Public methodExceptionMessageBox(Exception, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol)Creates an instance of ExceptionMessageBox by using information from the specified Exception and by specifying the buttons and symbol to display in the message box.
Public methodExceptionMessageBox(String, String, ExceptionMessageBoxButtons)Creates an instance of ExceptionMessageBox with the supplied top-level error message text and the dialog box caption of the exception message box. The method also specifies buttons to display in the exception message box.
Public methodExceptionMessageBox(Exception, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol, ExceptionMessageBoxDefaultButton)Creates an instance of ExceptionMessageBox by using information from the specified Exception and by specifying the buttons, symbol, and default button to display in the exception message box. .
Public methodExceptionMessageBox(String, String, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol)Creates an instance of ExceptionMessageBox with the supplied top-level error message text and dialog box caption of the exception message box. The method also specifies the buttons and symbol to display in the exception message box.
Public methodExceptionMessageBox(Exception, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol, ExceptionMessageBoxDefaultButton, ExceptionMessageBoxOptions)Creates an instance of ExceptionMessageBox by using information from the specified Exception and by specifying the buttons, symbol, default button, and other properties to display in the exception message box.
Public methodExceptionMessageBox(String, String, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol, ExceptionMessageBoxDefaultButton)Creates an instance of ExceptionMessageBox with the supplied top-level error message text and dialog box caption of the message box. The method also specifies the buttons, symbol, and default button to display in the exception message box.
Public methodExceptionMessageBox(String, String, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol, ExceptionMessageBoxDefaultButton, ExceptionMessageBoxOptions)Infrastructure. Creates an instance of ExceptionMessageBox with the supplied top-level error message text and dialog box caption of the message box. The method also specifies the buttons, symbol, default button, and dialog options to display in the exception message box.
Top
  NameDescription
Public propertyStatic memberAbortButtonTextGets the default text for the Abort button.
Public propertyBeepSpecifies whether to play an audible sound when the message is displayed.
Public propertyButtonsGets or sets the buttons to display in the message box.
Public propertyStatic memberCancelButtonTextGets the default text for the Cancel button.
Public propertyCaptionGets or sets the dialog box caption of the exception message box.
Public propertyCheckBoxRegistryKeySets an opened RegistryKey that controls the check box that is displayed on the exception message box when ShowCheckbox is true.
Public propertyCheckBoxRegistryMeansDoNotShowDialogDetermines whether the registry value content specified by CheckBoxRegistryKey and CheckBoxRegistryValue indicates a previous user decision not to view this message.
Public propertyCheckBoxRegistryValueGets or sets the registry value name that controls the check box on the exception message box when ShowCheckbox is true.
Public propertyCheckBoxTextGets or sets the text to display in the check box on the exception message box when ShowCheckbox is true.
Public propertyCustomDialogResultGets the clicked custom text dialog button.
Public propertyCustomSymbolGets or sets a custom bitmap to use as the symbol on the exception message box.
Public propertyDataGets the IDictionary interface that stores help link and advanced information associated with the top-level message.
Public propertyDefaultButtonGets or sets the default button on the message box.
Public propertyDefaultDialogResultGets or sets the value returned by the Show method when the user has previously indicated not to show a given message again.
Public propertyStatic memberFailButtonTextGets the default text for the Fail button.
Public propertyFontGets or sets the font used in the message box.
Public propertyHelpLinkGets or sets the link to the help file or help Web page associated with the top-level message.
Public propertyStatic memberIgnoreButtonTextGets the default text for the Ignore button.
Public propertyInnerExceptionGets or sets the Exception instance associated with the lower-level message(s).
Public propertyIsCheckBoxCheckedSpecifies whether the check box is selected when ShowCheckbox is true.
Public propertyMessageGets or sets the Exception that contains the message to display.
Public propertyMessageLevelDefaultGets or sets the number of message levels to display in the message box.
Public propertyStatic memberNoButtonTextGets the default text for the No button
Public propertyStatic memberOKButtonTextGets the default text for the OK button
Public propertyOptionsGets or sets miscellaneous display options for the message box
Public propertyStatic memberRetryButtonTextGets the default text for the Retry button.
Public propertyShowCheckBoxSpecifies whether to show the check box in the exception message box.
Public propertyShowToolBarSpecifies whether to show the command button toolbar on the exception message box.
Public propertySymbolGets or sets the symbol to display in the exception message box.
Public propertyTextGets or sets the text of the top-level message to display in the exception message box
Public propertyUseOwnerFontSpecifies whether to retrieve the font of the owner window and use it as the font for the exception message box.
Public propertyStatic memberYesButtonTextGets the default text for the Yes button
Top
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodStatic memberGetMessageTextReturns the string that a user can copy to the clipboard when the exception is displayed in an exception message box.
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodSetButtonText(String)Sets the text for the custom text button when only one button is displayed in the exception message box.
Public methodSetButtonText(String, String)Sets the text for the custom text buttons when only two buttons are displayed in the exception message box.
Public methodSetButtonText(String, String, String)Sets the text for the custom text buttons when only three buttons are displayed in the exception message box.
Public methodSetButtonText(String, String, String, String)Sets the text for the custom text buttons when only four buttons are displayed in the exception message box.
Public methodSetButtonText(String, String, String, String, String)Sets the text for the custom text buttons when only five buttons are displayed in the exception message box.
Public methodShow(IWin32Window)Shows the exception message box as a modal dialog box centered on the parent window.
Public methodShow(IntPtr, String, String, String, String, String, String, String)Displays the exception message box. Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.
Public methodToString (Inherited from Object.)
Top
  NameDescription
Public eventOnCopyToClipboardOccurs when exception message text is copied from the message box to the Clipboard.
Top

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);
			}
Try
    ' Do something that may generate an exception.
    Throw New ApplicationException("An error has occured")
Catch ex As ApplicationException
    ' Define a new top-level error message.
    Dim str As String = "The action failed."

    ' Add the new top-level message to the handled exception.
    Dim exTop As ApplicationException = New ApplicationException(str, ex)
    exTop.Source = Me.Text

    ' Show an exception message box with an OK button (the default).
    Dim box As ExceptionMessageBox = New ExceptionMessageBox(exTop)
    box.Show(Me)
End Try

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);
			}
Try
    ' Do something that you don't expect to generate an exception.
    Throw New ApplicationException("Failed to connect to the server.")
Catch ex As ApplicationException
    Dim str As String = "An unexpected error occurred. Please call Helpdesk."
    Dim exTop As ApplicationException = New ApplicationException(str, ex)
    exTop.Source = Me.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.
    Dim box As ExceptionMessageBox = New ExceptionMessageBox(exTop)

    box.Show(Me)

End Try
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.