DialogResult 열거형
대화 상자의 반환 값을 나타낼 식별자를 지정합니다.
네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)
구문
‘선언
<ComVisibleAttribute(True)> _
Public Enumeration DialogResult
‘사용 방법
Dim instance As DialogResult
[ComVisibleAttribute(true)]
public enum DialogResult
[ComVisibleAttribute(true)]
public enum class DialogResult
/** @attribute ComVisibleAttribute(true) */
public enum DialogResult
ComVisibleAttribute(true)
public enum DialogResult
멤버
멤버 이름 | 설명 | |
---|---|---|
Abort | 대화 상자 반환 값이 Abort입니다(일반적으로 중단 레이블이 붙은 단추에서 보냄). | |
Cancel | 대화 상자 반환 값이 Cancel입니다(일반적으로 취소 레이블이 붙은 단추에서 보냄). | |
Ignore | 대화 상자 반환 값이 Ignore입니다(일반적으로 무시 레이블이 붙은 단추에서 보냄). | |
No | 대화 상자 반환 값이 No입니다(일반적으로 아니요 레이블이 붙은 단추에서 보냄). | |
None | 대화 상자에서 Nothing이 반환됩니다. 이는 모달 대화 상자가 계속 실행 중임을 의미합니다. | |
OK | 대화 상자 반환 값은 OK입니다(일반적으로 확인 레이블이 붙은 단추에서 보냄). | |
Retry | 대화 상자 반환 값이 Retry입니다(일반적으로 다시 시도 레이블이 붙은 단추에서 보냄). | |
Yes | 대화 상자 반환 값이 Yes입니다(일반적으로 예 레이블이 붙은 단추에서 보냄). |
설명
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
플랫폼
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에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
2.0, 1.1, 1.0에서 지원
.NET Compact Framework
2.0, 1.0에서 지원