ExceptionMessageBoxDialogResult 열거형
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
사용자 지정 텍스트 단추가 사용될 때 사용자가 예외 메시지 상자를 닫기 위해 클릭한 단추를 식별합니다.
public enum class ExceptionMessageBoxDialogResult
public enum ExceptionMessageBoxDialogResult
type ExceptionMessageBoxDialogResult =
Public Enum ExceptionMessageBoxDialogResult
- 상속
-
ExceptionMessageBoxDialogResult
필드
Button1 | 1 | 첫 번째 사용자 지정 텍스트 단추입니다. |
Button2 | 2 | 두 번째 사용자 지정 텍스트 단추입니다. |
Button3 | 3 | 세 번째 사용자 지정 텍스트 단추입니다. |
Button4 | 4 | 네 번째 사용자 지정 텍스트 단추입니다. |
Button5 | 5 | 다섯 번째 사용자 지정 텍스트 단추입니다. |
None | 0 | 사용자 지정 텍스트 단추가 사용되지 않습니다. |
예제
try
{
// Do something that may cause an exception.
throw new ApplicationException("An error has occured");
}
catch (ApplicationException ex)
{
string str = "Action failed. What do you want to do?";
ApplicationException exTop = new ApplicationException(str, ex);
exTop.Source = this.Text;
// Show the exception message box with three custom buttons.
ExceptionMessageBox box = new ExceptionMessageBox(exTop);
// Set the names of the three custom buttons.
box.SetButtonText("Skip", "Retry", "Stop Processing");
// Set the Retry button as the default.
box.DefaultButton = ExceptionMessageBoxDefaultButton.Button2;
box.Symbol = ExceptionMessageBoxSymbol.Question;
box.Buttons = ExceptionMessageBoxButtons.Custom;
box.Show(this);
// Do something, depending on the button that the user clicks.
switch (box.CustomDialogResult)
{
case ExceptionMessageBoxDialogResult.Button1:
// Skip action
break;
case ExceptionMessageBoxDialogResult.Button2:
// Retry action
break;
case ExceptionMessageBoxDialogResult.Button3:
// Stop processing action
break;
}
}
Try
' Do something that may cause an exception.
Throw New ApplicationException("An error has occured")
Catch ex As ApplicationException
Dim str As String = "Action failed. What do you want to do?"
Dim exTop As ApplicationException = New ApplicationException(str, ex)
exTop.Source = Me.Text
' Show the exception message box with three custom buttons.
Dim box As ExceptionMessageBox = New ExceptionMessageBox(exTop)
' Set the names of the three custom buttons.
box.SetButtonText("Skip", "Retry", "Stop Processing")
' Set the Retry button as the default.
box.DefaultButton = ExceptionMessageBoxDefaultButton.Button2
box.Symbol = ExceptionMessageBoxSymbol.Question
box.Buttons = ExceptionMessageBoxButtons.Custom
box.Show(Me)
' Do something, depending on the button that the user clicks.
Select Case box.CustomDialogResult
Case ExceptionMessageBoxDialogResult.Button1
' Skip action
Case ExceptionMessageBoxDialogResult.Button2
' Retry action
Case ExceptionMessageBoxDialogResult.Button3
' Stop processing action
End Select
End Try