ExceptionMessageBox クラス
テキスト、ボタン、および記号によってカスタマイズ可能なメッセージ ボックスを表示し、Microsoft Windows .NET Framework ベース アプリケーションでの顧客の作業能力を向上させます。
名前空間: Microsoft.SqlServer.MessageBox
アセンブリ: Microsoft.ExceptionMessageBox (Microsoft.ExceptionMessageBox.dll)
構文
'宣言
<ComVisibleAttribute(False)> _
Public Class ExceptionMessageBox
'使用
Dim instance As ExceptionMessageBox
[ComVisibleAttribute(false)]
public class ExceptionMessageBox
[ComVisibleAttribute(false)]
public ref class ExceptionMessageBox
[<ComVisibleAttribute(false)>]
type ExceptionMessageBox = class end
public class ExceptionMessageBox
使用例
この例では、[OK] ボタンの付いたメッセージ ボックスを表示します。
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
この例では、例外メッセージ ボックスを使用して、トラブルシューティングやデバッグに役立つ追加情報を表示します。
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);
}
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
継承階層
System. . :: . .Object
Microsoft.SqlServer.MessageBox..::..ExceptionMessageBox
スレッド セーフ
この型の public static (Visual Basic では Shared) のメンバーはすべて、スレッド セーフです。インスタンス メンバーの場合は、スレッド セーフであるとは限りません。