다음을 통해 공유


ExceptionMessageBox.ShowCheckBox 속성

Specifies whether to show the check box in the exception message box.

네임스페이스:  Microsoft.SqlServer.MessageBox
어셈블리:  Microsoft.ExceptionMessageBox(Microsoft.ExceptionMessageBox.dll)

구문

‘선언
Public Property ShowCheckBox As Boolean 
    Get 
    Set
‘사용 방법
Dim instance As ExceptionMessageBox 
Dim value As Boolean 

value = instance.ShowCheckBox

instance.ShowCheckBox = value
public bool ShowCheckBox { get; set; }
public:
property bool ShowCheckBox {
    bool get ();
    void set (bool value);
}
member ShowCheckBox : bool with get, set
function get ShowCheckBox () : boolean 
function set ShowCheckBox (value : boolean)

속성 값

유형: System.Boolean
A Boolean value.

주의

The value of the check box can be evaluated at runtime when an exception occurs to determine whether to display the exception message box. For more information, see 프로그램 예외 메시지 상자.

The default value is false.

           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 네임스페이스

CheckboxText