ExceptionMessageBox.CheckBoxText 属性

Gets or sets the text to display in the check box on the exception message box when ShowCheckbox is true.

命名空间:  Microsoft.SqlServer.MessageBox
程序集:  Microsoft.ExceptionMessageBox(在 Microsoft.ExceptionMessageBox.dll 中)

语法

声明
Public Property CheckBoxText As String 
    Get 
    Set
用法
Dim instance As ExceptionMessageBox 
Dim value As String 

value = instance.CheckBoxText

instance.CheckBoxText = value
public string CheckBoxText { get; set; }
public:
property String^ CheckBoxText {
    String^ get ();
    void set (String^ value);
}
member CheckBoxText : string with get, set
function get CheckBoxText () : String 
function set CheckBoxText (value : String)

属性值

类型:System.String
A String value.

注释

The default value is "Do not show this message again".

示例

            try
            {
                // Do something that may cause an exception.
                throw new ApplicationException("An error has occured.");
            }
            catch (ApplicationException ex)
            {
                string str = "The action failed.";
                ApplicationException exTop = new ApplicationException(str, ex);
                exTop.Source = this.Text;

                // Show a message box if the global variable is true.
                if (alwaysShow)
                {
                    ExceptionMessageBox box = new ExceptionMessageBox(exTop);
                    box.ShowCheckBox = true;
                    box.IsCheckBoxChecked = true;
                    box.CheckBoxText = "Always show this message";
                    box.Show(this);

                    // Set the global variable.
                    alwaysShow = box.IsCheckBoxChecked;
                }
            }
Try
    ' Do something that may cause an exception.
    Throw New ApplicationException("An error has occured.")
Catch ex As ApplicationException
    Dim str As String = "The action failed."
    Dim exTop As ApplicationException = New ApplicationException(str, ex)
    exTop.Source = Me.Text

    ' Show a message box if the global variable is true.
    If alwaysShow Then
        Dim box As ExceptionMessageBox = New ExceptionMessageBox(exTop)
        box.ShowCheckBox = True
        box.IsCheckBoxChecked = True
        box.CheckBoxText = "Always show this message"
        box.Show(Me)

        ' Set the global variable.
        alwaysShow = box.IsCheckBoxChecked
    End If
End Try

请参阅

参考

ExceptionMessageBox 类

Microsoft.SqlServer.MessageBox 命名空间