ListViewUpdatedEventArgs.ExceptionHandled プロパティ

定義

更新操作中に発生した例外がイベント ハンドラーで処理されたかどうかを示す値を取得または設定します。

public:
 property bool ExceptionHandled { bool get(); void set(bool value); };
public bool ExceptionHandled { get; set; }
member this.ExceptionHandled : bool with get, set
Public Property ExceptionHandled As Boolean

プロパティ値

イベント ハンドラーで例外が処理された場合は true。それ以外の場合は false。 既定値は、false です。

次の例では、 プロパティを使用して、 ExceptionHandled イベント ハンドラーで例外が処理されたことを示す方法を示します。 このコード例は、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

注釈

更新操作中に例外が発生した場合は、 プロパティを ExceptionHandled 使用して、イベント中に例外を処理したかどうかを示します。 このプロパティが に true設定されている場合、例外は処理されたと見なされ、コントロールによって ListView 再スローされません。 このプロパティが に false設定されている場合、コントロールは ListView 例外を再スローします。 発生した例外を確認するには、 プロパティを使用します Exception

適用対象

こちらもご覧ください