Condividi tramite


ExceptionMessageBox.Show Metodo

Definizione

Visualizza la finestra di messaggio eccezione.

Overload

Show(IWin32Window)

Mostra la finestra di messaggio eccezione come una finestra di dialogo modale allineata al centro nella finestra padre.

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

Visualizza la finestra di messaggio eccezione. Identificato solo a scopo informativo. Non supportata. Non è garantita la compatibilità con le versioni future.

Show(IWin32Window)

Mostra la finestra di messaggio eccezione come una finestra di dialogo modale allineata al centro nella finestra padre.

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

Parametri

owner
IWin32Window

Finestra padre per la finestra di messaggio eccezione.

Restituisce

Oggetto DialogResult del pulsante su cui l'utente ha fatto clic.

Esempio

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

Commenti

Quando Buttons è Custom, Show restituisce Cancelsempre . Usare CustomDialogResult per determinare il pulsante selezionato dall'utente.

Quando viene specificato un null valore per Owner, la finestra di messaggio di eccezione viene visualizzata sulla barra delle applicazioni di Windows. È consigliabile passare invece l'oggetto finestra padre.

Si applica a

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

Visualizza la finestra di messaggio eccezione. Identificato solo a scopo informativo. Non supportata. Non è garantita la compatibilità con le versioni future.

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

Parametri

hwnd
IntPtr

nativeint

System.IntPtr, ovvero un handle della finestra padre.

message
String

Stringa contenente il messaggio per l'eccezione associata a questa istanza.

source
String

Stringa contenente l'origine per l'eccezione associata a questa istanza.

sourceAppName
String

Stringa contenente il nome dell'applicazione di origine.

sourceAppVersion
String

Stringa contenente la versione dell'applicazione di origine.

sourceModule
String

Stringa contenente il nome del modulo di origine.

sourceMessageId
String

Stringa contenente l'ID del messaggio di origine.

sourceLanguage
String

Stringa contenente la lingua di origine.

Restituisce

Oggetto DialogResult del pulsante su cui l'utente ha fatto clic.

Si applica a