Compartir a través de


ListViewUpdatedEventArgs.ExceptionHandled Propiedad

Definición

Obtiene o establece un valor que indica si la excepción que se inició durante la operación de actualización se controló durante un evento.

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

Valor de propiedad

Boolean

Es true si la excepción se ha controlado en el controlador de eventos; en caso contrario, es false. De manera predeterminada, es false.

Ejemplos

En el ejemplo siguiente se muestra cómo usar la ExceptionHandled propiedad para indicar que la excepción se controló en el controlador de eventos. Este ejemplo de código forma parte de un ejemplo más grande proporcionado para la ListViewUpdatedEventArgs clase .

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

Comentarios

Si se produce una excepción durante la operación de actualización, use la ExceptionHandled propiedad para indicar si ha controlado la excepción durante el evento. Si esta propiedad se establece trueen , el control considera la excepción y el ListView control no vuelve a iniciar la excepción. Si esta propiedad se establece en , el ListView control vuelve a falseproducir la excepción. Para determinar qué excepción se generó, use la Exception propiedad .

Se aplica a

Consulte también