Share via


CheckBoxRegistryMeansDoNotShowDialog プロパティ

CheckBoxRegistryKey および CheckBoxRegistryValue により指定されたレジストリ値の内容が、このメッセージを表示しないというユーザーの以前の決定を示しているかどうかを判別します。

名前空間:  Microsoft.SqlServer.MessageBox
アセンブリ:  Microsoft.ExceptionMessageBox (Microsoft.ExceptionMessageBox.dll)

構文

'宣言
Public Property CheckBoxRegistryMeansDoNotShowDialog As Boolean
    Get
    Set
'使用
Dim instance As ExceptionMessageBox
Dim value As Boolean

value = instance.CheckBoxRegistryMeansDoNotShowDialog

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

プロパティ値

型: System. . :: . .Boolean
Boolean の値です。

説明

ShowCheckbox()()()() が true、かつ CheckBoxRegistryMeansDoNotShowDialog が true で、さらにレジストリ値が存在しており、0 ではない値が含まれる場合は、例外メッセージ ボックスが表示されず、Show が呼び出される際に ExceptionMessageBox により DefaultDialogResult が返されます。

チェック ボックス テキストが "今後、このメッセージを表示しない" または同様のメッセージである場合、このプロパティは通常 true です。

使用例

           try
            {
                // Do something that could generate an exception.
                throw new ApplicationException("An error has occured.");
            }
            catch (ApplicationException ex)
            {
                string str = "The action failed. Do you want to continue?";
                ApplicationException exTop = new ApplicationException(str, ex);
                exTop.Source = this.Text;

                // Show a message box with Yes and No buttons
                ExceptionMessageBox box = new ExceptionMessageBox(exTop,
                    ExceptionMessageBoxButtons.YesNo,
                    ExceptionMessageBoxSymbol.Question,
                    ExceptionMessageBoxDefaultButton.Button2);

                // Enable the check box.
                box.ShowCheckBox = true;

                // Define the registry key to use.
                box.CheckBoxRegistryKey =
                    Microsoft.Win32.Registry.CurrentUser.CreateSubKey(
                    @"Software\TestApp");
                box.CheckBoxRegistryValue = "DontShowActionFailedMessage";
                box.CheckBoxRegistryMeansDoNotShowDialog = true;
                box.DefaultDialogResult = DialogResult.Yes;

                // The message box won’t be displayed if the
                // "DontShowActionFailedMessage" value of the registry key 
                // contains a non-zero value.
                if (box.Show(this) == DialogResult.No)
                {
                    // Do something if the user clicks the No button.
                    this.Close();
                }
            }
Try
    ' Do something that could generate an exception.
    Throw New ApplicationException("An error has occured.")
Catch ex As ApplicationException
    Dim str As String = "The action failed. Do you want to continue?"
    Dim exTop As ApplicationException = New ApplicationException(str, ex)
    exTop.Source = Me.Text

    ' Show a message box with Yes and No buttons
    Dim box As ExceptionMessageBox = New ExceptionMessageBox(exTop, _
     ExceptionMessageBoxButtons.YesNo, _
     ExceptionMessageBoxSymbol.Question, _
     ExceptionMessageBoxDefaultButton.Button2)

    ' Enable the check box.
    box.ShowCheckBox = True

    ' Define the registry key to use.
    box.CheckBoxRegistryKey = _
    Microsoft.Win32.Registry.CurrentUser.CreateSubKey( _
     "Software\TestApp")
    box.CheckBoxRegistryValue = "DontShowActionFailedMessage"
    box.CheckBoxRegistryMeansDoNotShowDialog = True
    box.DefaultDialogResult = Windows.Forms.DialogResult.Yes

    ' The message box won�t be displayed if the
    ' "DontShowActionFailedMessage" value of the registry key 
    ' contains a non-zero value.
    If box.Show(Me) = Windows.Forms.DialogResult.No Then
        ' Do something if the user clicks the No button.
        Me.Close()
    End If
End Try