DialogResult 열거형

정의

대화 상자의 반환 값을 나타낼 식별자를 지정합니다.

public enum class DialogResult
[System.Runtime.InteropServices.ComVisible(true)]
public enum DialogResult
public enum DialogResult
[<System.Runtime.InteropServices.ComVisible(true)>]
type DialogResult = 
type DialogResult = 
Public Enum DialogResult
상속
DialogResult
특성

필드

Abort 3

대화 상자 반환 값이 Abort입니다(일반적으로 중단 레이블이 붙은 단추에서 보냄).

Cancel 2

대화 상자 반환 값이 Cancel입니다(일반적으로 취소 레이블이 붙은 단추에서 보냄).

Continue 11

대화 상자 반환 값은 Continue(일반적으로 Continue라는 레이블이 지정된 단추에서 전송됨)입니다.

Ignore 5

대화 상자 반환 값이 Ignore입니다(일반적으로 무시 레이블이 붙은 단추에서 보냄).

No 7

대화 상자 반환 값이 No입니다(일반적으로 아니요 레이블이 붙은 단추에서 보냄).

None 0

대화 상자에서 Nothing이 반환됩니다. 이는 모달 대화 상자가 계속 실행 중임을 의미합니다.

OK 1

대화 상자 반환 값은 OK입니다(일반적으로 확인 레이블이 붙은 단추에서 보냄).

Retry 4

대화 상자 반환 값이 Retry입니다(일반적으로 다시 시도 레이블이 붙은 단추에서 보냄).

TryAgain 10

대화 상자 반환 값은 다시 시도(일반적으로 다시 시도라는 레이블이 지정된 단추에서 전송됨)입니다.

Yes 6

대화 상자 반환 값이 Yes입니다(일반적으로 예 레이블이 붙은 단추에서 보냄).

예제

다음 코드 예제에 표시 하는 방법을 보여 줍니다.는 MessageBox 의이 오버 로드에 의해 지원 되는 옵션을 사용 하 여 Show입니다. 있는지 확인 한 후 문자열 변수인 ServerName는 비어 있는 경우이 예제에서는 표시를 MessageBox, 사용자 작업을 취소 하는 옵션을 제공 합니다. Show 메서드의 반환 값이 Yes로 평가되면 표시된 MessageBox 양식이 닫힙니다.

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.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 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 = System.Windows.Forms.DialogResult.Yes Then

            ' Closes the parent form.

            Me.Close()

        End If

    End If

End Sub

설명

속성과 메서드는 Button.DialogResult Form.ShowDialog 이 열거형을 사용합니다.

적용 대상

추가 정보