ExceptionMessageBoxDialogResult Enumeración
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Identifica el botón en el que el usuario hizo clic para cerrar el cuadro de mensaje de excepción cuando se usan botones de texto personalizado.
public enum class ExceptionMessageBoxDialogResult
public enum ExceptionMessageBoxDialogResult
type ExceptionMessageBoxDialogResult =
Public Enum ExceptionMessageBoxDialogResult
- Herencia
-
ExceptionMessageBoxDialogResult
Campos
Button1 | 1 | El primer botón de texto personalizado. |
Button2 | 2 | El segundo botón de texto personalizado. |
Button3 | 3 | El tercer botón de texto personalizado. |
Button4 | 4 | El cuarto botón de texto personalizado. |
Button5 | 5 | El quinto botón de texto personalizado. |
None | 0 | Los botones de texto personalizado no se usan. |
Ejemplos
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