ExceptionMessageBoxDialogResult 열거형

Identifies the button that the user clicked to close the exception message box when custom text buttons are used.

네임스페이스:  Microsoft.SqlServer.MessageBox
어셈블리:  Microsoft.ExceptionMessageBox(Microsoft.ExceptionMessageBox.dll)

public enum ExceptionMessageBoxDialogResult

멤버 이름설명
Button1The first custom text button.
Button2The second custom text button.
Button3The third custom text button.
Button4The fourth custom text button.
Button5The fifth custom text button.
NoneCustom text buttons are not used.

			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

커뮤니티 추가 항목

추가
표시: