ErrorEventArgs クラスの新しいインスタンスを初期化します。
Public Sub New( _
ByVal exception As Exception _)
[C#]
public ErrorEventArgs(
Exceptionexception);
[C++]
public: ErrorEventArgs(
Exception* exception);
[JScript]
public function ErrorEventArgs(
exception : Exception);
パラメータ
- exception
発生したエラーを表す Exception 。
使用例
[Visual Basic, C#, C++] 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
[C#]
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);
}
[C++]
int main() {
//Creates an exception with an error message.
Exception* myException= new Exception(S"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(String::Concat( S"The returned exception is: ", myReturnedException->Message ));
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows NT Server 4.0, Windows NT Workstation 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ