DialogResult 列挙体とは? わかりやすく解説

DialogResult 列挙体

ダイアログ ボックス戻り値を示す識別子指定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

<ComVisibleAttribute(True)> _
Public Enumeration DialogResult
[ComVisibleAttribute(true)] 
public enum DialogResult
[ComVisibleAttribute(true)] 
public enum class DialogResult
/** @attribute ComVisibleAttribute(true) */ 
public enum DialogResult
ComVisibleAttribute(true) 
public enum DialogResult
メンバメンバ
解説解説

この列挙体は、Button.DialogResult プロパティおよび Form.ShowDialog メソッド使用されます。

使用例使用例
Private Sub ValidateUserEntry5()

    ' Checks the value of the text.

    If ServerName.Text.Length = 0 Then

        ' Initializes variables to pass to the MessageBox.Show method.

        Dim Message As String
 = "You did not enter a server name. Cancel this operation?"
        Dim Caption As String
 = "No Server Name Specified"
        Dim Buttons As Integer
 = MessageBoxButtons.YesNo

        Dim Result As DialogResult

        'Displays a MessageBox using the Question icon and specifying
 the No button as the default.

        Result = MessageBox.Show(Me, Message, Caption, MessageBoxButtons.YesNo)

        ' Gets the result of the MessageBox display.

        If Result = DialogResult.Yes Then

            ' Closes the parent form.

            Me.Close()

        End If

    End If

End Sub
private void validateUserEntry5()
{

    // Checks the value of the text.

    if(serverName.Text.Length == 0)
    {

        // Initializes the variables to pass to the MessageBox.Show
 method.

        string message = "You did not enter a server name.
 Cancel this operation?";
        string caption = "No Server Name Specified";
        MessageBoxButtons buttons = MessageBoxButtons.YesNo;
        DialogResult result;

        // Displays the MessageBox.

        result = MessageBox.Show(this, message, caption, buttons);

        if(result == DialogResult.Yes)
        {

            // Closes the parent form.

            this.Close();

        }

    }

}
private:
   void validateUserEntry5()
   {
      // Checks the value of the text.
      if ( serverName->Text->Length == 0 )
      {
         // Initializes the variables to pass to the MessageBox::Show
 method.
         String^ message = "You did not enter a server name. Cancel this
 operation?";
         String^ caption = "No Server Name Specified";
         MessageBoxButtons buttons = MessageBoxButtons::YesNo;
         System::Windows::Forms::DialogResult result;

         // Displays the MessageBox.
         result = MessageBox::Show( this, message, caption, buttons
 );
         if ( result == ::DialogResult::Yes )
         {
            // Closes the parent form.
            this->Close();
         }
      }
   }
private void ValidateUserEntry5()
{
    // Checks the value of the text.
    if (serverName.get_Text().get_Length() == 0) {
        // Initializes the variables to pass to the MessageBox.Show
 method.
        String message = "You did not enter a server name. "
            + "Cancel this operation?";
        String caption = "No Server Name Specified";
        MessageBoxButtons buttons = MessageBoxButtons.YesNo;
        DialogResult result;

        // Displays the MessageBox.
        result = MessageBox.Show(this, message, caption, buttons);

        if (result.Equals(DialogResult.Yes)) {
            // Closes the parent form.
            this.Close();
        }
    }
} //ValidateUserEntry5 
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DialogResult 列挙体」の関連用語

DialogResult 列挙体のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DialogResult 列挙体のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS