ExceptionMessageBox.Show ExceptionMessageBox.Show ExceptionMessageBox.Show ExceptionMessageBox.Show Method

Definition

Displays the exception message box.

Overloads

Show(IWin32Window) Show(IWin32Window) Show(IWin32Window) Show(IWin32Window)

Shows the exception message box as a modal dialog box centered on the parent window.

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

Displays the exception message box. Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.

Show(IWin32Window) Show(IWin32Window) Show(IWin32Window) Show(IWin32Window)

Shows the exception message box as a modal dialog box centered on the parent window.

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

Parameters

owner
IWin32Window IWin32Window IWin32Window IWin32Window

Parent window for the exception message box.

Returns

The DialogResult of the button clicked by the user.

Examples

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

Remarks

When Buttons is Custom, Show always returns Cancel. Use CustomDialogResult to determine which button the user clicked.

When a null value is supplied for Owner, the exception message box appears on the Windows Taskbar. We recommend that you pass the parent window object instead.

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

Displays the exception message box. Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.

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

Parameters

hwnd
IntPtr IntPtr IntPtr IntPtr

An System.IntPtr which is a handle to the parent window.

message
String String String String

A string containing the message for the exception associated with this instance.

source
String String String String

A string containing the source for the exception associated with this instance.

sourceAppName
String String String String

A string containing the name of the source application.

sourceAppVersion
String String String String

A string containing the source application version.

sourceModule
String String String String

A string containing the source module name.

sourceMessageId
String String String String

A string containing the source message ID.

sourceLanguage
String String String String

A string containing the source language.

Returns

The DialogResult of the button clicked by the user.

Applies to