ExceptionMessageBox.Show Methode

Definition

Zeigt das Ausnahmemeldungsfeld an.

Überlädt

Show(IWin32Window)

Zeigt das Ausnahmemeldungsfeld als modales, im übergeordneten Fenster zentriertes Dialogfeld an.

Show(IntPtr, String, String, String, String, String, String, String)

Zeigt das Ausnahmemeldungsfeld an. Nur für Informationszwecke identifiziert. Wird nicht unterstützt. Zukünftige Kompatibilität wird nicht sichergestellt.

Show(IWin32Window)

Zeigt das Ausnahmemeldungsfeld als modales, im übergeordneten Fenster zentriertes Dialogfeld an.

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

Parameter

owner
IWin32Window

Übergeordnetes Fenster für das Ausnahmemeldungsfeld.

Gibt zurück

DialogResult der Schaltfläche, auf die der Benutzer geklickt hat.

Beispiele

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

Hinweise

Wann Buttons ist Custom, Show gibt immer zurück Cancel. Verwenden Sie CustomDialogResult die Ermittlung, auf welche Schaltfläche der Benutzer geklickt hat.

Wenn ein null Wert für angegeben wird, wird das Meldungsfeld " OwnerAusnahme" auf der Windows-Taskleiste angezeigt. Es wird empfohlen, stattdessen das übergeordnete Fensterobjekt zu übergeben.

Gilt für:

Show(IntPtr, String, String, String, String, String, String, String)

Zeigt das Ausnahmemeldungsfeld an. Nur für Informationszwecke identifiziert. Wird nicht unterstützt. Zukünftige Kompatibilität wird nicht sichergestellt.

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

Parameter

hwnd
IntPtr

nativeint

Ein System.IntPtr-Element, das ein Handle für das übergeordnete Fenster ist.

message
String

Eine Zeichenfolge, die die Meldung für die dieser Instanz zugeordnete Ausnahme enthält.

source
String

Eine Zeichenfolge, die die Quelle für die dieser Instanz zugeordnete Ausnahme enthält.

sourceAppName
String

Eine Zeichenfolge, die den Namen der Quellanwendung enthält.

sourceAppVersion
String

Eine Zeichenfolge, die die Quellanwendungsversion enthält.

sourceModule
String

Eine Zeichenfolge, die den Namen des Quellmoduls enthält.

sourceMessageId
String

Eine Zeichenfolge, die die Quellmeldungs-ID enthält.

sourceLanguage
String

Eine Zeichenfolge, die die Quellmeldungssprache enthält.

Gibt zurück

DialogResult der Schaltfläche, auf die der Benutzer geklickt hat.

Gilt für: