ListChangedEventArgs クラス

定義

ListChanged イベントのデータを提供します。

public ref class ListChangedEventArgs : EventArgs
public class ListChangedEventArgs : EventArgs
type ListChangedEventArgs = class
    inherit EventArgs
Public Class ListChangedEventArgs
Inherits EventArgs
継承
ListChangedEventArgs

次のコード例では、この型の使用方法を示します。 この例では、イベント ハンドラーがイベントの BindingSource.ListChanged 発生を報告します。 このレポートは、イベントが発生したタイミングを知るのに役立ち、デバッグに役立ちます。 複数のイベントまたは頻繁に発生するイベントを報告するには、 を Console.WriteLine に置き換えるかMessageBox.Show、複数行TextBoxにメッセージを追加することを検討してください。

コード例を実行するには、 という名前BindingSource1の型BindingSourceのインスタンスを含むプロジェクトに貼り付けます。 次に、イベント ハンドラーが イベントに関連付けられていることを確認します 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

注釈

ListChangedイベントは、内のデータIBindingListが変更されたときに発生します。

プロパティは NewIndex 、追加、変更、または削除されたアイテムのインデックスを示します。 アイテムが移動された場合、 プロパティは NewIndex アイテムの新しい場所を示し、 プロパティは OldIndex 古い場所を示します。

変更の影響を受ける項目が 1 つだけの場合、プロパティ値 OldIndex は -1 です。

コンストラクター

ListChangedEventArgs(ListChangedType, Int32)

変更の種類と影響を受ける項目のインデックスを指定して、ListChangedEventArgs クラスの新しいインスタンスを初期化します。

ListChangedEventArgs(ListChangedType, Int32, Int32)

変更の種類と、移動された項目の古いインデックスと新しいインデックスを指定して、ListChangedEventArgs クラスの新しいインスタンスを初期化します。

ListChangedEventArgs(ListChangedType, Int32, PropertyDescriptor)

変更の種類、影響を受ける項目のインデックス、および影響を受ける項目を記述する ListChangedEventArgs を指定して、PropertyDescriptor クラスの新しいインスタンスを初期化します。

ListChangedEventArgs(ListChangedType, PropertyDescriptor)

変更の種類と影響を受ける ListChangedEventArgs を指定して、PropertyDescriptor クラスの新しいインスタンスを初期化します。

プロパティ

ListChangedType

変更の種類を取得します。

NewIndex

変更の影響を受ける項目のインデックスを取得します。

OldIndex

移動された項目の古いインデックスを取得します。

PropertyDescriptor

追加、変更、または削除された PropertyDescriptor を取得します。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください