クリックして評価とフィードバックをお寄せください
MSDN
MSDN ライブラリ
SQL Server
SQL Server 2008
データベース エンジン
テクニカル リファレンス
Microsoft.SqlServer.MessageBox
ExceptionMessageBox Class

  低帯域幅での表示をオンにする
コミュニティ コンテンツ
このセクションの内容
その他のバージョンについては、以下の情報を参照してください。
ExceptionMessageBox Class

テキスト、ボタン、および記号によってカスタマイズ可能なメッセージ ボックスを表示し、Microsoft Windows .NET Framework ベース アプリケーションでの顧客の作業能力を向上させます。

名前空間: Microsoft.SqlServer.MessageBox
アセンブリ: Microsoft.ExceptionMessageBox (microsoft.exceptionmessagebox.dll 内)
Visual Basic (Declaration)
<ComVisibleAttribute(False)> _
Public Class ExceptionMessageBox
C#
[ComVisibleAttribute(false)] 
public class ExceptionMessageBox
C++
[ComVisibleAttribute(false)] 
public ref class ExceptionMessageBox
J#
/** @attribute ComVisibleAttribute(false) */ 
public class ExceptionMessageBox
JScript
ComVisibleAttribute(false) 
public class ExceptionMessageBox
System.Object
  Microsoft.SqlServer.MessageBox.ExceptionMessageBox

この例では、[OK] ボタンの付いたメッセージ ボックスを表示します。

C#
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);
}
Visual Basic
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

この例では、例外メッセージ ボックスを使用して、トラブルシューティングやデバッグに役立つ追加情報を表示します。

C#
try
{
    // Do something that you don't expect to generate an exception.
    throw new ApplicationException("Failed to connect to the server.");
}
catch (ApplicationException ex)
{
    string str = "An unexpected error occurred. Please call Helpdesk.";
    ApplicationException exTop = new ApplicationException(str, ex);
    exTop.Source = this.Text;

    // Information in the Data property of an exception that has a name
    // beginning with "HelpLink.Advanced" is shown when the user
    // clicks the Advanced Information button of the exception message
    // box dialog box.
    exTop.Data.Add("AdvancedInformation.FileName", "application.dll");
    exTop.Data.Add("AdvancedInformation.FilePosition", "line 355");
    exTop.Data.Add("AdvancedInformation.UserContext", "single user mode");

    // Show the exception message box with additional information that 
    // is helpful when a user calls technical support.
    ExceptionMessageBox box = new ExceptionMessageBox(exTop);

    box.Show(this);
}
Visual Basic
Try
    ' Do something that you don't expect to generate an exception.
    Throw New ApplicationException("Failed to connect to the server.")
Catch ex As ApplicationException
    Dim str As String = "An unexpected error occurred. Please call Helpdesk."
    Dim exTop As ApplicationException = New ApplicationException(str, ex)
    exTop.Source = Me.Text

    ' Information in the Data property of an exception that has a name
    ' beginning with "HelpLink.Advanced" is shown when the user
    ' clicks the Advanced Information button of the exception message
    ' box dialog box.
    exTop.Data.Add("AdvancedInformation.FileName", "application.dll")
    exTop.Data.Add("AdvancedInformation.FilePosition", "line 355")
    exTop.Data.Add("AdvancedInformation.UserContext", "single user mode")

    ' Show the exception message box with additional information that 
    ' is helpful when a user calls technical support.
    Dim box As ExceptionMessageBox = New ExceptionMessageBox(exTop)

    box.Show(Me)

End Try
この型の public static (Microsoft Visual Basic ではShared ) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

開発プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

対象プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
コミュニティ コンテンツ   コミュニティ コンテンツとは
新しいコンテンツの追加 RSS  注釈
Processing
© 2009 Microsoft Corporation. All rights reserved. 使用条件  |  商標  |  プライバシー
Page view tracker