ListViewUpdatedEventArgs.Exception プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
更新操作中に例外が発生した場合は、その例外を取得します。
public:
property Exception ^ Exception { Exception ^ get(); };
public Exception Exception { get; }
member this.Exception : Exception
Public ReadOnly Property Exception As Exception
プロパティ値
更新操作中に発生した例外。例外が発生しなかった場合は null
。
例
次の例は、プロパティを使用 Exception して、更新操作中に例外が発生したかどうかを判断する方法を示しています。 このコード例は、ListViewUpdatedEventArgs クラスのために提供されている大規模な例の一部です。
void ContactsListView_ItemUpdated(Object sender, ListViewUpdatedEventArgs e)
{
if (e.Exception != null)
{
if (e.AffectedRows == 0)
{
e.KeepInEditMode = true;
Message.Text = "An exception occurred updating the contact. " +
"Please verify your values and try again.";
}
else
Message.Text = "An exception occurred updating the contact. " +
"Please verify the values in the recently updated item.";
e.ExceptionHandled = true;
}
}
Sub ContactsListView_ItemUpdated(sender As Object, e As ListViewUpdatedEventArgs)
If e.Exception IsNot Nothing Then
If e.AffectedRows = 0 Then
e.KeepInEditMode = True
Message.Text = "An exception occurred updating the contact. " & _
"Please verify your values and try again."
Else
Message.Text = "An exception occurred updating the contact. " & _
"Please verify the values in the recently updated item."
End If
e.ExceptionHandled = True
End If
End Sub
注釈
更新 Exception 操作中に発生した例外 (存在する場合) を確認するには、このプロパティを使用します。 例外が発生しなかった場合、このプロパティは .null
注意
例外が発生し、イベント ハンドラーで例外を処理する場合は、プロパティを > にExceptionHandledtrue
設定します。 それ以外の場合、コントロールは ListView 例外を再スローします。