The exception message box API is installed with the SQL Server 2005 graphical components. It is implemented in the ExceptionMessageBox
class in the Microsoft.SqlServer.MessageBox namespace and enhances the standard message box implemented in the System.Windows.Forms.MessageBox class. The ExceptionMessageBox class includes the following enhanced functionality:
The following example shows how to use the exception message box within a .NET application. The example executes a RAISERROR T-SQL statement as the source of the error.
This example displays the optional checkbox on the exception message box. The checkbox lets the user control whether the message box is displayed for subsequent occurrences of the same exception.
Clicking the Show Technical Details icon (rightmost icon in the toolbar at the bottom left of the message box) brings up the Advanced Information dialog box, containing a hierarchy of error information that the user can drill down through, as shown in Figure 6-5.
Table 6-11. ExceptionMessageBox instance properties
Property | Description |
---|
Beep | Gets or sets whether to play a sound when the message box is displayed. |
Buttons | Gets or sets the buttons to display in the message box. A value from the ExceptionMessageBoxButtons enumeration. |
Caption | Gets or sets the caption for the exception message box. |
CheckBoxRegistryKey | Gets or sets the registry key that specifies the initial checkbox value if the ShowCheckBox property is TRue. This property is used together with the CheckBoxRegistryValue property. |
CheckBoxRegistryMeansDoNotShowDialog | Gets or sets whether the registry value indicated by the CheckBoxRegistryKey and CheckBoxRegistryValue properties indicates that the user decided not to view the message. |
CheckBoxRegistryValue | Gets or sets the registry value that specifies the initial checkbox value if the ShowCheckBox property is TRue. This property is used together with the CheckBoxRegistryKey property. |
CheckBoxText | Gets or sets the text to display for the checkbox on the exception message box when the ShowCheckbox property is true. |
CustomDialogResult | Gets the custom message box button that was clicked. This is a value from the ExceptionMessageBoxDialogResult enumeration. None is returned if the Buttons property is not set to ExceptionMessageBoxButtons.Custom. |
CustomSymbol | Gets or sets a Bitmap to use as the symbol on the message box. |
Data | Gets an IDictionary interface for help link and advanced information details associated with the top-level message. |
DefaultButton | Gets or sets the default button in the message box when Buttons is ExceptionMessageBoxButtons.Custom. A value from the ExceptionMessageBoxDefaultButton enumeration. |
DefaultDialogResult | Gets or sets the value as a member of the DialogResult enumeration returned by the Show( ) method when the user has specified not to show the dialog box for subsequent occurrences of the same message. |
Font | Gets or sets the font used in the message box. |
HelpLink | Gets or sets a link to a help file or web page as help as additional help to the top-level message. |
InnerException | Gets or sets the inner exception of the message box as an Exception instance. |
IsCheckBoxChecked | Gets or sets whether the checkbox on the exception message box is checked when the ShowCheckboxProperty is true. |
Message | Gets or sets the exception (as an Exception instance) for the message box. |
MessageLevelDefault | Gets or sets the number of message levels to display in the message box. |
Options | Gets or sets display options for the message box using values in the ExceptionMessageBoxOptions enumeration. |
ShowCheckBox | Gets or sets whether to show the checkbox on the exception message boxthe checkbox lets the user control whether the message box is displayed for subsequent occurrences of the same exception. |
ShowToolbar | Gets or sets whether to display the toolbar with the help, copy, and show advanced information buttons. |
Symbol | Gets or sets the symbol to display in the message box using a value from the ExceptionMessageBoxSymbol enumeration. |
Text | Gets or sets the text to display in the message box. |
UseOwnerFont | Gets or sets whether to retrieve and use the font of the parent window as the font for the message box. |