CurrencyManager.ListChanged Olay

Tanım

Liste değiştiğinde veya listedeki bir öğe değiştiğinde gerçekleşir.

public:
 event System::ComponentModel::ListChangedEventHandler ^ ListChanged;
public event System.ComponentModel.ListChangedEventHandler ListChanged;
public event System.ComponentModel.ListChangedEventHandler? ListChanged;
member this.ListChanged : System.ComponentModel.ListChangedEventHandler 
Public Custom Event ListChanged As ListChangedEventHandler 

Olay Türü

Örnekler

Aşağıdaki kod örneğinde bu üyenin kullanımı gösterilmektedir. Örnekte, olay işleyicisi olayın oluşumunu ListChanged bildirir. Bu rapor, olayın ne zaman gerçekleştiğini öğrenmenize yardımcı olur ve hata ayıklamada size yardımcı olabilir. Birden çok olayı veya sık gerçekleşen olayları raporlamak için, iletisini ile MessageBox.Show değiştirmeyi Console.WriteLine veya çok satırlı TextBoxbir iletiye eklemeyi göz önünde bulundurun.

Örnek kodu çalıştırmak için, adlı CurrencyManagertürünün CurrencyManager1 bir örneğini içeren bir projeye yapıştırın. Ardından olay işleyicisinin olayla ilişkilendirildiğinden ListChanged emin olun.

private void CurrencyManager1_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 CurrencyManager1_ListChanged(sender as Object, e as ListChangedEventArgs) _ 
     Handles CurrencyManager1.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

Açıklamalar

Bir ListChanged öğede CurrencyManager yapılan değişiklikler , EndCurrentEditve CancelCurrentEditgibi Refreshyöntemler kullanılarak yapıldığında olay sınıfı tarafından oluşturulur. Bu olay, veri kaynağı arabirimini uygularsa IBindingListView doğrudan düzenlendiğinde de oluşabilir.

İlişkili OnListChanged yöntem bu sınıftaki özel bir yöntemdir.

Olayları işleme hakkında daha fazla bilgi için bkz . Olayları İşleme ve Oluşturma.

Şunlara uygulanır

Ayrıca bkz.