ListChangedEventArgs.ListChangedType Proprietà

Definizione

Ottiene il tipo di modifica.

public:
 property System::ComponentModel::ListChangedType ListChangedType { System::ComponentModel::ListChangedType get(); };
public System.ComponentModel.ListChangedType ListChangedType { get; }
member this.ListChangedType : System.ComponentModel.ListChangedType
Public ReadOnly Property ListChangedType As ListChangedType

Valore della proprietà

Valore ListChangedType che indica il tipo di modifica.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso di questo membro. Nell'esempio un gestore eventi segnala l'occorrenza dell'evento BindingSource.ListChanged . Questo report consente di apprendere quando si verifica l'evento e può essere utile per il debug. Per segnalare più eventi o eventi che si verificano di frequente, provare a sostituire MessageBox.Show o Console.WriteLine accodare il messaggio a un oggetto multilinea TextBox.

Per eseguire il codice di esempio, incollarlo in un progetto contenente un'istanza di tipo BindingSource denominata BindingSource1. Assicurarsi quindi che il gestore eventi sia associato all'evento BindingSource.ListChanged .

private void BindingSource1_ListChanged(Object sender, ListChangedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "ListChangedType", e.ListChangedType );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "NewIndex", e.NewIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "OldIndex", e.OldIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "PropertyDescriptor", e.PropertyDescriptor );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "ListChanged Event" );
}
Private Sub BindingSource1_ListChanged(sender as Object, e as ListChangedEventArgs) _ 
     Handles BindingSource1.ListChanged

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "ListChangedType", e.ListChangedType)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "NewIndex", e.NewIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "OldIndex", e.OldIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "PropertyDescriptor", e.PropertyDescriptor)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"ListChanged Event")

End Sub

Si applica a

Vedi anche