ErrorEventArgs.GetException メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ErrorEventArgs.GetException メソッドの意味・解説 

ErrorEventArgs.GetException メソッド

発生したエラーを表す Exception を取得します。

名前空間: System.IO
アセンブリ: System (system.dll 内)
構文構文

Public Overridable Function
 GetException As Exception
Dim instance As ErrorEventArgs
Dim returnValue As Exception

returnValue = instance.GetException
public:
virtual Exception^ GetException ()
public Exception GetException ()

戻り値
発生したエラーを表す Exception。

使用例使用例

ErrorEventArgs の新しいインスタンスを作成し、そのインスタンスを Exception を使用して初期化する例を次に示します。次に GetException を呼び出して Exception を取得し、エラー メッセージを表示します。このコードに関連付けられたフォームはありません。

Public Shared Sub Main()
    'Creates an exception with an error message.
    Dim myException As New
 Exception("This is an exception test")
       
    'Creates an ErrorEventArgs with the exception.
    Dim myErrorEventArgs As New
 ErrorEventArgs(myException)
       
    'Extracts the exception from the ErrorEventArgs and display it.
    Dim myReturnedException As Exception =
 myErrorEventArgs.GetException()
    MessageBox.Show("The returned exception is: "
 _
       + myReturnedException.Message)
End Sub
public static void Main(string[]
 args) {
   //Creates an exception with an error message.
   Exception myException= new Exception("This is an exception
 test");

   //Creates an ErrorEventArgs with the exception.
   ErrorEventArgs myErrorEventArgs = new ErrorEventArgs(myException);

   //Extracts the exception from the ErrorEventArgs and display it.
   Exception myReturnedException = myErrorEventArgs.GetException();
   MessageBox.Show("The returned exception is: " + myReturnedException.Message);
}
int main()
{
   
   //Creates an exception with an error message.
   Exception^ myException = gcnew Exception( "This is an exception test"
 );
   
   //Creates an ErrorEventArgs with the exception.
   ErrorEventArgs^ myErrorEventArgs = gcnew ErrorEventArgs( myException );
   
   //Extracts the exception from the ErrorEventArgs and display it.
   Exception^ myReturnedException = myErrorEventArgs->GetException();
   MessageBox::Show( String::Concat( "The returned exception is: ", myReturnedException->Message
 ) );
}

public static void main(String[]
 args)
{
    //Creates an exception with an error message.
    System.Exception myException = 
        new System.Exception("This is an exception test");

    //Creates an ErrorEventArgs with the exception.
    ErrorEventArgs myErrorEventArgs = new ErrorEventArgs(myException);

    //Extracts the exception from the ErrorEventArgs and display it.
    System.Exception myReturnedException = myErrorEventArgs.GetException();

    MessageBox.Show("The returned exception is: " 
        + myReturnedException.get_Message());
} //main
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

ErrorEventArgs.GetException メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ErrorEventArgs.GetException メソッドのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS