次の方法で共有


ExceptionMessageBox コンストラクター (Exception)

指定した Exception の情報を使用して、ExceptionMessageBox のインスタンスを作成します。

名前空間:  Microsoft.SqlServer.MessageBox
アセンブリ:  Microsoft.ExceptionMessageBox (Microsoft.ExceptionMessageBox.dll)

構文

'宣言
Public Sub New ( _
    exception As Exception _
)
'使用
Dim exception As Exception

Dim instance As New ExceptionMessageBox(exception)
public ExceptionMessageBox(
    Exception exception
)
public:
ExceptionMessageBox(
    Exception^ exception
)
new : 
        exception:Exception -> ExceptionMessageBox
public function ExceptionMessageBox(
    exception : Exception
)

パラメーター

  • exception
    型: System. . :: . .Exception
    例外メッセージ ボックスに表示される最上位レベル テキスト、内部例外テキスト、キャプション、データ、ヘルプ リンク、およびオプションの追加情報が含まれる Exception です。

使用例

          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