ExceptionMessageBox.ShowCheckBox Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Spécifie s'il faut afficher la case à cocher dans la boîte de message d'exception.
public:
property bool ShowCheckBox { bool get(); void set(bool value); };
public bool ShowCheckBox { get; set; }
member this.ShowCheckBox : bool with get, set
Public Property ShowCheckBox As Boolean
Valeur de propriété
Valeur Boolean.
Exemples
try
{
// Do something that may cause an exception.
throw new ApplicationException("An error has occured.");
}
catch (ApplicationException ex)
{
string str = "The action failed.";
ApplicationException exTop = new ApplicationException(str, ex);
exTop.Source = this.Text;
// Show a message box if the global variable is true.
if (alwaysShow)
{
ExceptionMessageBox box = new ExceptionMessageBox(exTop);
box.ShowCheckBox = true;
box.IsCheckBoxChecked = true;
box.CheckBoxText = "Always show this message";
box.Show(this);
// Set the global variable.
alwaysShow = box.IsCheckBoxChecked;
}
}
Try
' Do something that may cause an exception.
Throw New ApplicationException("An error has occured.")
Catch ex As ApplicationException
Dim str As String = "The action failed."
Dim exTop As ApplicationException = New ApplicationException(str, ex)
exTop.Source = Me.Text
' Show a message box if the global variable is true.
If alwaysShow Then
Dim box As ExceptionMessageBox = New ExceptionMessageBox(exTop)
box.ShowCheckBox = True
box.IsCheckBoxChecked = True
box.CheckBoxText = "Always show this message"
box.Show(Me)
' Set the global variable.
alwaysShow = box.IsCheckBoxChecked
End If
End Try
Remarques
La valeur de la case à cocher peut être évaluée au moment de l’exécution lorsqu’une exception se produit pour déterminer s’il faut afficher la zone de message d’exception. Pour plus d’informations, consultez La zone de message d’exception du programme.
La valeur par défaut est false
.