ExceptionMessageBox.Show Méthode
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.
Affiche la boîte de message d'exception.
Surcharges
Show(IWin32Window) |
Affiche la boîte de message d'exception sous la forme d'une boîte de dialogue modale centrée sur la fenêtre parente. |
Show(IntPtr, String, String, String, String, String, String, String) |
Affiche la boîte de message d'exception. Identifié à titre d'information uniquement. Non pris en charge. La compatibilité future n'est pas garantie. |
Show(IWin32Window)
Affiche la boîte de message d'exception sous la forme d'une boîte de dialogue modale centrée sur la fenêtre parente.
public:
System::Windows::Forms::DialogResult Show(System::Windows::Forms::IWin32Window ^ owner);
public System.Windows.Forms.DialogResult Show (System.Windows.Forms.IWin32Window owner);
member this.Show : System.Windows.Forms.IWin32Window -> System.Windows.Forms.DialogResult
Public Function Show (owner As IWin32Window) As DialogResult
Paramètres
- owner
- IWin32Window
Fenêtre parente de la boîte de message d'exception.
Retours
DialogResult du bouton sur lequel l'utilisateur a cliqué.
Exemples
try
{
// Do something that may generate an exception.
throw new ApplicationException("An error has occured");
}
catch (ApplicationException ex)
{
// Define a new top-level error message.
string str = "The action failed.";
// Add the new top-level message to the handled exception.
ApplicationException exTop = new ApplicationException(str, ex);
exTop.Source = this.Text;
// Show an exception message box with an OK button (the default).
ExceptionMessageBox box = new ExceptionMessageBox(exTop);
box.Show(this);
}
Try
' Do something that may generate an exception.
Throw New ApplicationException("An error has occured")
Catch ex As ApplicationException
' Define a new top-level error message.
Dim str As String = "The action failed."
' Add the new top-level message to the handled exception.
Dim exTop As ApplicationException = New ApplicationException(str, ex)
exTop.Source = Me.Text
' Show an exception message box with an OK button (the default).
Dim box As ExceptionMessageBox = New ExceptionMessageBox(exTop)
box.Show(Me)
End Try
Remarques
Quand Buttons c’est Custom, Show retourne Canceltoujours . Permet CustomDialogResult de déterminer le bouton sur lequel l’utilisateur a cliqué.
Lorsqu’une null
valeur est fournie pour Owner
, la boîte de message d’exception s’affiche dans la barre des tâches Windows. Nous vous recommandons de passer l’objet de fenêtre parent à la place.
S’applique à
Show(IntPtr, String, String, String, String, String, String, String)
Affiche la boîte de message d'exception. Identifié à titre d'information uniquement. Non pris en charge. La compatibilité future n'est pas garantie.
public:
System::Windows::Forms::DialogResult Show(IntPtr hwnd, System::String ^ message, System::String ^ source, System::String ^ sourceAppName, System::String ^ sourceAppVersion, System::String ^ sourceModule, System::String ^ sourceMessageId, System::String ^ sourceLanguage);
public System.Windows.Forms.DialogResult Show (IntPtr hwnd, string message, string source, string sourceAppName, string sourceAppVersion, string sourceModule, string sourceMessageId, string sourceLanguage);
member this.Show : nativeint * string * string * string * string * string * string * string -> System.Windows.Forms.DialogResult
Public Function Show (hwnd As IntPtr, message As String, source As String, sourceAppName As String, sourceAppVersion As String, sourceModule As String, sourceMessageId As String, sourceLanguage As String) As DialogResult
Paramètres
- hwnd
-
IntPtr
nativeint
System.IntPtr qui est un descripteur de la fenêtre parente.
- message
- String
Chaîne qui contient le message pour l'exception associée à cette instance.
- source
- String
Chaîne qui contient la source pour l'exception associée à cette instance.
- sourceAppName
- String
Chaîne contenant le nom de l'application source.
- sourceAppVersion
- String
Chaîne contenant la version de l'application de source.
- sourceModule
- String
Chaîne contenant le nom du module source.
- sourceMessageId
- String
Chaîne contenant l'ID du message source.
- sourceLanguage
- String
Chaîne contenant l'ID du langage source.
Retours
DialogResult du bouton sur lequel l'utilisateur a cliqué.