DialogResult 列挙体
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

<ComVisibleAttribute(True)> _ Public Enumeration DialogResult

メンバ名 | 説明 | |
---|---|---|
![]() | Abort | ダイアログ ボックスの戻り値は Abort です (通常は "中止" というラベルが指定されたボタンから送られます)。 |
![]() | Cancel | ダイアログ ボックスの戻り値は Cancel です (通常は "キャンセル" というラベルが指定されたボタンから送られます)。 |
![]() | Ignore | ダイアログ ボックスの戻り値は Ignore です (通常は "無視" というラベルが指定されたボタンから送られます)。 |
![]() | No | ダイアログ ボックスの戻り値は No です (通常は "いいえ" というラベルが指定されたボタンから送られます)。 |
![]() | None | ダイアログ ボックスから Nothing が返されます。つまり、モーダル ダイアログ ボックスの実行が継続します。 |
![]() | OK | ダイアログ ボックスの戻り値は OK です (通常は "OK" というラベルが指定されたボタンから送られます)。 |
![]() | Retry | ダイアログ ボックスの戻り値は Retry です (通常は "再試行" というラベルが指定されたボタンから送られます)。 |
![]() | Yes | ダイアログ ボックスの戻り値は Yes です (通常は "はい" というラベルが指定されたボタンから送られます)。 |


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

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- DialogResult 列挙体のページへのリンク