ListViewUpdatedEventArgs.ExceptionHandled Proprietà

Definizione

Ottiene o imposta un valore che indica se un'eccezione generata durante l'operazione di aggiornamento è stata gestita durante l'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

Valore della proprietà

true se l'eccezione è stata gestita nel gestore eventi, altrimenti false. Il valore predefinito è false.

Esempio

Nell'esempio seguente viene illustrato come utilizzare la ExceptionHandled proprietà per indicare che l'eccezione è stata gestita nel gestore eventi. Questo esempio di codice fa parte di un esempio più ampio fornito per la ListViewUpdatedEventArgs classe .

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

Commenti

Se durante l'operazione di aggiornamento viene generata un'eccezione, utilizzare la ExceptionHandled proprietà per indicare se l'eccezione è stata gestita durante l'evento. Se questa proprietà è impostata su true, l'eccezione viene considerata gestita e non viene generata nuovamente dal ListView controllo . Se questa proprietà è impostata su false, il ListView controllo genera nuovamente l'eccezione. Per determinare quale eccezione è stata generata, utilizzare la Exception proprietà .

Si applica a

Vedi anche