共用方式為


ExceptionMessageBox Constructors

Definition

Overloaded constructor for ExceptionMessageBox.

Overloads

ExceptionMessageBox()

Creates an instance of ExceptionMessageBox with the default properties.

ExceptionMessageBox(Exception)

Creates an instance of ExceptionMessageBox by using information from the specified Exception.

ExceptionMessageBox(String)

Creates an instance of ExceptionMessageBox with the supplied top-level error message text.

ExceptionMessageBox(Exception, ExceptionMessageBoxButtons)

Creates an instance of ExceptionMessageBox by using information from the specified Exception and by specifying the buttons to display in the message box.

ExceptionMessageBox(String, String)

Creates an instance of ExceptionMessageBox with the supplied top-level error message text and the dialog box caption of the exception message box.

ExceptionMessageBox(Exception, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol)

Creates an instance of ExceptionMessageBox by using information from the specified Exception and by specifying the buttons and symbol to display in the message box.

ExceptionMessageBox(String, String, ExceptionMessageBoxButtons)

Creates an instance of ExceptionMessageBox with the supplied top-level error message text and the dialog box caption of the exception message box. The method also specifies buttons to display in the exception message box.

ExceptionMessageBox(Exception, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol, ExceptionMessageBoxDefaultButton)

Creates an instance of ExceptionMessageBox by using information from the specified Exception and by specifying the buttons, symbol, and default button to display in the exception message box. .

ExceptionMessageBox(String, String, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol)

Creates an instance of ExceptionMessageBox with the supplied top-level error message text and dialog box caption of the exception message box. The method also specifies the buttons and symbol to display in the exception message box.

ExceptionMessageBox(Exception, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol, ExceptionMessageBoxDefaultButton, ExceptionMessageBoxOptions)

Creates an instance of ExceptionMessageBox by using information from the specified Exception and by specifying the buttons, symbol, default button, and other properties to display in the exception message box.

ExceptionMessageBox(String, String, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol, ExceptionMessageBoxDefaultButton)

Creates an instance of ExceptionMessageBox with the supplied top-level error message text and dialog box caption of the message box. The method also specifies the buttons, symbol, and default button to display in the exception message box.

ExceptionMessageBox(String, String, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol, ExceptionMessageBoxDefaultButton, ExceptionMessageBoxOptions)

Creates an instance of ExceptionMessageBox with the supplied top-level error message text and dialog box caption of the message box. The method also specifies the buttons, symbol, default button, and dialog options to display in the exception message box.

ExceptionMessageBox()

Creates an instance of ExceptionMessageBox with the default properties.

public:
 ExceptionMessageBox();
public ExceptionMessageBox ();
Public Sub New ()

Applies to

ExceptionMessageBox(Exception)

Creates an instance of ExceptionMessageBox by using information from the specified Exception.

public:
 ExceptionMessageBox(Exception ^ exception);
public ExceptionMessageBox (Exception exception);
new Microsoft.SqlServer.MessageBox.ExceptionMessageBox : Exception -> Microsoft.SqlServer.MessageBox.ExceptionMessageBox
Public Sub New (exception As Exception)

Parameters

exception
Exception

Exception that contains the top-level text, inner exception text, caption, data, help link, and optional additional information to display in the exception message box.

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

Applies to

ExceptionMessageBox(String)

Creates an instance of ExceptionMessageBox with the supplied top-level error message text.

public:
 ExceptionMessageBox(System::String ^ text);
public ExceptionMessageBox (string text);
new Microsoft.SqlServer.MessageBox.ExceptionMessageBox : string -> Microsoft.SqlServer.MessageBox.ExceptionMessageBox
Public Sub New (text As String)

Parameters

text
String

Error text of the top-level message.

Applies to

ExceptionMessageBox(Exception, ExceptionMessageBoxButtons)

Creates an instance of ExceptionMessageBox by using information from the specified Exception and by specifying the buttons to display in the message box.

public:
 ExceptionMessageBox(Exception ^ exception, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxButtons buttons);
public ExceptionMessageBox (Exception exception, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons buttons);
new Microsoft.SqlServer.MessageBox.ExceptionMessageBox : Exception * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons -> Microsoft.SqlServer.MessageBox.ExceptionMessageBox
Public Sub New (exception As Exception, buttons As ExceptionMessageBoxButtons)

Parameters

exception
Exception

Exception that contains the top-level text, inner exception text, caption, data, help link, and optional additional information to display in the exception message box.

buttons
ExceptionMessageBoxButtons

ExceptionMessageBoxButtons enumeration that specifies the buttons to display in the message box.

Applies to

ExceptionMessageBox(String, String)

Creates an instance of ExceptionMessageBox with the supplied top-level error message text and the dialog box caption of the exception message box.

public:
 ExceptionMessageBox(System::String ^ text, System::String ^ caption);
public ExceptionMessageBox (string text, string caption);
new Microsoft.SqlServer.MessageBox.ExceptionMessageBox : string * string -> Microsoft.SqlServer.MessageBox.ExceptionMessageBox
Public Sub New (text As String, caption As String)

Parameters

text
String

Error text of the top-level message.

caption
String

Caption of the exception message box.

Applies to

ExceptionMessageBox(Exception, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol)

Creates an instance of ExceptionMessageBox by using information from the specified Exception and by specifying the buttons and symbol to display in the message box.

public:
 ExceptionMessageBox(Exception ^ exception, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxButtons buttons, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxSymbol symbol);
public ExceptionMessageBox (Exception exception, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons buttons, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxSymbol symbol);
new Microsoft.SqlServer.MessageBox.ExceptionMessageBox : Exception * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxSymbol -> Microsoft.SqlServer.MessageBox.ExceptionMessageBox
Public Sub New (exception As Exception, buttons As ExceptionMessageBoxButtons, symbol As ExceptionMessageBoxSymbol)

Parameters

exception
Exception

Exception that contains the top-level text, inner exception text, caption, data, help link, and optional additional information to display in the exception message box.

buttons
ExceptionMessageBoxButtons

ExceptionMessageBoxButtons enumeration that specifies the buttons to display in the exception message box.

symbol
ExceptionMessageBoxSymbol

ExceptionMessageBoxSymbol enumeration that specifies the symbol to display in the exception message box.

Applies to

ExceptionMessageBox(String, String, ExceptionMessageBoxButtons)

Creates an instance of ExceptionMessageBox with the supplied top-level error message text and the dialog box caption of the exception message box. The method also specifies buttons to display in the exception message box.

public:
 ExceptionMessageBox(System::String ^ text, System::String ^ caption, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxButtons buttons);
public ExceptionMessageBox (string text, string caption, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons buttons);
new Microsoft.SqlServer.MessageBox.ExceptionMessageBox : string * string * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons -> Microsoft.SqlServer.MessageBox.ExceptionMessageBox
Public Sub New (text As String, caption As String, buttons As ExceptionMessageBoxButtons)

Parameters

text
String

Error text of the top-level message.

caption
String

Caption of the exception message box.

buttons
ExceptionMessageBoxButtons

ExceptionMessageBoxButtons enumeration that specifies the buttons to display in the exception message box.

Applies to

ExceptionMessageBox(Exception, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol, ExceptionMessageBoxDefaultButton)

Creates an instance of ExceptionMessageBox by using information from the specified Exception and by specifying the buttons, symbol, and default button to display in the exception message box. .

public:
 ExceptionMessageBox(Exception ^ exception, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxButtons buttons, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxSymbol symbol, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxDefaultButton defaultButton);
public ExceptionMessageBox (Exception exception, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons buttons, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxSymbol symbol, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxDefaultButton defaultButton);
new Microsoft.SqlServer.MessageBox.ExceptionMessageBox : Exception * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxSymbol * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxDefaultButton -> Microsoft.SqlServer.MessageBox.ExceptionMessageBox
Public Sub New (exception As Exception, buttons As ExceptionMessageBoxButtons, symbol As ExceptionMessageBoxSymbol, defaultButton As ExceptionMessageBoxDefaultButton)

Parameters

exception
Exception

Exception that contains the top-level text, inner exception text, caption, data, help link, and optional additional information to display in the exception message box.

buttons
ExceptionMessageBoxButtons

ExceptionMessageBoxButtons enumeration that specifies the buttons to display in the exception message box.

symbol
ExceptionMessageBoxSymbol

ExceptionMessageBoxSymbol enumeration that specifies the symbol to display in the exception message box.

defaultButton
ExceptionMessageBoxDefaultButton

ExceptionMessageBoxDefaultButton enumeration that specifies the default button for the exception message box.

Applies to

ExceptionMessageBox(String, String, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol)

Creates an instance of ExceptionMessageBox with the supplied top-level error message text and dialog box caption of the exception message box. The method also specifies the buttons and symbol to display in the exception message box.

public:
 ExceptionMessageBox(System::String ^ text, System::String ^ caption, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxButtons buttons, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxSymbol symbol);
public ExceptionMessageBox (string text, string caption, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons buttons, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxSymbol symbol);
new Microsoft.SqlServer.MessageBox.ExceptionMessageBox : string * string * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxSymbol -> Microsoft.SqlServer.MessageBox.ExceptionMessageBox
Public Sub New (text As String, caption As String, buttons As ExceptionMessageBoxButtons, symbol As ExceptionMessageBoxSymbol)

Parameters

text
String

Error text of the top-level message.

caption
String

Dialog box caption of the exception message box.

buttons
ExceptionMessageBoxButtons

ExceptionMessageBoxButtons enumeration that specifies the buttons to display in the exception message box.

symbol
ExceptionMessageBoxSymbol

ExceptionMessageBoxSymbol enumeration that specifies the symbol to display in the exception message box.

Applies to

ExceptionMessageBox(Exception, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol, ExceptionMessageBoxDefaultButton, ExceptionMessageBoxOptions)

Creates an instance of ExceptionMessageBox by using information from the specified Exception and by specifying the buttons, symbol, default button, and other properties to display in the exception message box.

public:
 ExceptionMessageBox(Exception ^ exception, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxButtons buttons, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxSymbol symbol, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxDefaultButton defaultButton, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxOptions options);
public ExceptionMessageBox (Exception exception, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons buttons, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxSymbol symbol, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxDefaultButton defaultButton, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxOptions options);
new Microsoft.SqlServer.MessageBox.ExceptionMessageBox : Exception * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxSymbol * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxDefaultButton * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxOptions -> Microsoft.SqlServer.MessageBox.ExceptionMessageBox
Public Sub New (exception As Exception, buttons As ExceptionMessageBoxButtons, symbol As ExceptionMessageBoxSymbol, defaultButton As ExceptionMessageBoxDefaultButton, options As ExceptionMessageBoxOptions)

Parameters

exception
Exception

Exception that contains the top-level text, inner exception text, caption, data, help link, and optional additional information to display in the exception message box.

buttons
ExceptionMessageBoxButtons

ExceptionMessageBoxButtons enumeration that specifies the buttons to display in the exception message box.

symbol
ExceptionMessageBoxSymbol

ExceptionMessageBoxSymbol enumeration that specifies the symbol to display in the exception message box.

defaultButton
ExceptionMessageBoxDefaultButton

ExceptionMessageBoxDefaultButton enumeration that specifies the default button for the exception message box.

options
ExceptionMessageBoxOptions

The ExceptionMessageBoxOptions enumeration that controls other behaviors of the exception message box.

Applies to

ExceptionMessageBox(String, String, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol, ExceptionMessageBoxDefaultButton)

Creates an instance of ExceptionMessageBox with the supplied top-level error message text and dialog box caption of the message box. The method also specifies the buttons, symbol, and default button to display in the exception message box.

public:
 ExceptionMessageBox(System::String ^ text, System::String ^ caption, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxButtons buttons, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxSymbol symbol, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxDefaultButton defaultButton);
public ExceptionMessageBox (string text, string caption, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons buttons, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxSymbol symbol, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxDefaultButton defaultButton);
new Microsoft.SqlServer.MessageBox.ExceptionMessageBox : string * string * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxSymbol * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxDefaultButton -> Microsoft.SqlServer.MessageBox.ExceptionMessageBox
Public Sub New (text As String, caption As String, buttons As ExceptionMessageBoxButtons, symbol As ExceptionMessageBoxSymbol, defaultButton As ExceptionMessageBoxDefaultButton)

Parameters

text
String

Error text of the top-level message.

caption
String

Dialog box caption of the exception message box.

buttons
ExceptionMessageBoxButtons

ExceptionMessageBoxButtons enumeration that specifies the buttons to display in the exception message box.

symbol
ExceptionMessageBoxSymbol

ExceptionMessageBoxSymbol enumeration that specifies the symbol to display in the exception message box.

defaultButton
ExceptionMessageBoxDefaultButton

ExceptionMessageBoxDefaultButton enumeration that specifies the default button for the exception message box.

Examples

// Define the message and caption to display.
string str = @"Are you sure you want to delete file 'c:\somefile.txt'?";
string caption = "Confirm File Deletion";

// Show the exception message box with Yes and No buttons.
ExceptionMessageBox box = new ExceptionMessageBox(str,
    caption, ExceptionMessageBoxButtons.YesNo,
    ExceptionMessageBoxSymbol.Question,
    ExceptionMessageBoxDefaultButton.Button2);

if (DialogResult.Yes == box.Show(this))
{
    // Delete the file.
}
' Define the message and caption to display.
Dim str As String = "Are you sure you want to delete file 'c:\somefile.txt'?"
Dim caption As String = "Confirm File Deletion"

' Show the exception message box with Yes and No buttons.
Dim box As ExceptionMessageBox = New ExceptionMessageBox(str, _
 caption, ExceptionMessageBoxButtons.YesNo, _
 ExceptionMessageBoxSymbol.Question, _
 ExceptionMessageBoxDefaultButton.Button2)

If Windows.Forms.DialogResult.Yes = box.Show(Me) Then
    ' Delete the file.
End If

Applies to

ExceptionMessageBox(String, String, ExceptionMessageBoxButtons, ExceptionMessageBoxSymbol, ExceptionMessageBoxDefaultButton, ExceptionMessageBoxOptions)

Creates an instance of ExceptionMessageBox with the supplied top-level error message text and dialog box caption of the message box. The method also specifies the buttons, symbol, default button, and dialog options to display in the exception message box.

public:
 ExceptionMessageBox(System::String ^ text, System::String ^ caption, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxButtons buttons, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxSymbol symbol, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxDefaultButton defaultButton, Microsoft::SqlServer::MessageBox::ExceptionMessageBoxOptions options);
public ExceptionMessageBox (string text, string caption, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons buttons, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxSymbol symbol, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxDefaultButton defaultButton, Microsoft.SqlServer.MessageBox.ExceptionMessageBoxOptions options);
new Microsoft.SqlServer.MessageBox.ExceptionMessageBox : string * string * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxButtons * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxSymbol * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxDefaultButton * Microsoft.SqlServer.MessageBox.ExceptionMessageBoxOptions -> Microsoft.SqlServer.MessageBox.ExceptionMessageBox
Public Sub New (text As String, caption As String, buttons As ExceptionMessageBoxButtons, symbol As ExceptionMessageBoxSymbol, defaultButton As ExceptionMessageBoxDefaultButton, options As ExceptionMessageBoxOptions)

Parameters

text
String

Error text of the top-level message.

caption
String

Dialog box caption of the exception message box.

buttons
ExceptionMessageBoxButtons

ExceptionMessageBoxSymbol enumeration that specifies the symbol to display in the exception message box.

symbol
ExceptionMessageBoxSymbol

ExceptionMessageBoxSymbol enumeration that specifies the symbol to display in the exception message box.

defaultButton
ExceptionMessageBoxDefaultButton

ExceptionMessageBoxDefaultButton enumeration that specifies the default button for the exception message box.

options
ExceptionMessageBoxOptions

The ExceptionMessageBoxOptions enumeration that controls other behaviors of the exception message box.

Applies to