指定した例外および例外に関する情報をメッセージ ボックスに表示します。
Sub ShowError( _
ByVal ex As Exception, _ ByVal message As String _)
[C#]
void ShowError(
Exceptionex,stringmessage);
[C++]
void ShowError(
Exception* ex,String* message);
[JScript]
function ShowError(
ex : Exception,message : String);
パラメータ
- ex
表示する Exception 。 - message
例外に関する情報を提供する、表示対象のメッセージ。
解説
このメソッドを使用すると、メッセージ ボックスの表示が開発環境に適切に統合されます。
使用例
[Visual Basic, C#, C++] IUIService のインスタンスを取得し、サービスの ShowError メソッドを呼び出すコード例を次に示します。
Dim UIservice As IUIService = CType(Me.GetService( _
GetType(System.Windows.Forms.Design.IUIService)), IUIService)
If Not (UIservice Is Nothing) Then
UIservice.ShowError(New Exception( _
"This is a message in a test exception, displayed by the IUIService", _
New ArgumentException("Test inner exception")))
End If
[C#]
IUIService UIservice = (IUIService)this.GetService(
typeof( System.Windows.Forms.Design.IUIService ) );
if( UIservice != null )
UIservice.ShowError( new Exception(
"This is a message in a test exception, " +
"displayed by the IUIService",
new ArgumentException("Test inner exception")));
[C++]
IUIService* UIservice = dynamic_cast<IUIService*>(this->GetService(__typeof(System::Windows::Forms::Design::IUIService)));
if (UIservice != 0)
UIservice->ShowError(new Exception(S"This is a message in a test exception, displayed by the IUIService", new ArgumentException(S"Test inner exception")));
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
IUIService インターフェイス | IUIService メンバ | System.Windows.Forms.Design 名前空間 | IUIService.ShowError オーバーロードの一覧