BindingManagerBase イベント

名前 | 説明 | |
---|---|---|
![]() | BindingComplete | データ バインディング操作の完了時に発生します。 |
![]() | CurrentChanged | 現在バインドされている項目が変更されると発生します。 |
![]() | CurrentItemChanged | 現在バインドされている項目の状態が変更されたときに発生します。 |
![]() | DataError | Exception が BindingManagerBase によって処理された場合に発生します。 |
![]() | PositionChanged | Position プロパティの値が変更された後に発生します。 |

関連項目
BindingManagerBase クラスSystem.Windows.Forms 名前空間
BindingSource
BindingContext クラス
CurrencyManager
PropertyManager
BindingManagerBase クラス
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)


BindingManagerBase は、同じデータ ソースにバインドされた Windows フォームのデータ バインド コントロールを同期できるようにします。データ ソースへのコントロールの単純バインディングの詳細については、Binding クラスのトピックを参照してください。たとえば、同じデータ ソースの異なる列にバインドされた 2 つの TextBox コントロールが配置されているフォームがあるとします。データ ソースは顧客の名前を格納している DataTable であり、列には姓と名が格納されているとします。同じ顧客に対して正しい姓と名を同時に表示するには、この 2 つのコントロールを同期させます。BindingManagerBase クラスから継承された CurrencyManager が、データ ソースの現在の項目へのポインタを維持することで、この同期を実行します。TextBox コントロールは、現在の項目にバインドされているため、同じ行の情報を表示します。現在の項目が変更されると、CurrencyManager が、すべての連結コントロールにデータを更新するように通知します。さらに、Position プロパティを設定して、コントロールが指す DataTable の行を指定できます。データ ソース内の行の数を確認するには、Count プロパティを使用します。
データ ソースが現在の項目のポインタを維持しているとは限らないため、CurrencyManager が必要です。たとえば、配列と ArrayList オブジェクトはデータ ソースになる場合がありますが、現在の項目を返すプロパティは持っていません。現在の項目を取得するには、Current プロパティを使用します。
PropertyManager も BindingManagerBase から継承され、データ ソース内の現在のオブジェクトのプロパティではなく、オブジェクトの現在のプロパティを維持するために使用されます。このため、PropertyManager に対する Position プロパティまたは Count プロパティの設定は無効です。
BindingManagerBase を作成するには、BindingContext クラスを使用します。この操作では、管理されているデータ ソースに応じて、CurrencyManager または PropertyManager のいずれかが返されます。
ソリューション プログラマは、コントロールを BindingSource コンポーネントに直接バインドすることをお勧めします。これは、データ ソースと、実際の対象データ ソースへのデータ コネクタの両方として機能します。BindingSource により、コントロールと対象の間の現在性の管理など、単純または複合データ バインディングが大幅に簡素化されます。
継承時の注意 BindingManagerBase から継承する場合は、抽象メンバである AddNew、Count、CancelCurrentEdit、Current、EndCurrentEdit、GetItemProperties、OnCurrentChanged、Position、RemoveAt、ResumeBinding、SuspendBinding、および UpdateIsBinding をオーバーライドする必要があります。
BindingContext を使用して、特定のデータ ソースに対して BindingManagerBase を返すコード例を次に示します。この例では、モジュールの宣言セクションで myBindingManagerBase を宣言していることを前提にしています。さらに、この例では CurrentChanged イベントおよび PositionChanged イベントにイベント デリゲートを追加しています。最後に、この例には、Position プロパティをインクリメントまたはデクリメントし、Position をリストの最初または最後の行に設定する 4 つのメソッド (MoveNext、MovePrevious、MoveFirst、および MoveLast) が含まれています。リストの最後の行は、Count プロパティを使用して確認します。
Private Sub GetBindingManagerBase ' CustomersToOrders is the RelationName of a DataRelation. ' Therefore, the list maintained by the BindingManagerBase is the ' list of orders that belong to a specific customer in the ' DataTable named Customers, found in DataSet. myBindingManagerBase = Me.BindingContext(DataSet1, _ "Customers.CustomersToOrders") ' Adds delegates to the CurrentChanged and PositionChanged events. AddHandler myBindingManagerBase.PositionChanged, _ AddressOf BindingManagerBase_PositionChanged AddHandler myBindingManagerBase.CurrentChanged, _ AddressOf BindingManagerBase_CurrentChanged End Sub Private Sub BindingManagerBase_PositionChanged _ (sender As Object, e As EventArgs) ' Prints the new Position of the BindingManagerBase. Console.Write("Position Changed: ") Console.WriteLine(CType(sender, BindingManagerBase).Position) End Sub Private Sub BindingManagerBase_CurrentChanged _ (sender As Object, e As EventArgs) ' Prints the new value of the current object. Console.Write("Current Changed: ") Console.WriteLine(CType(sender, BindingManagerBase).Current) End Sub Private Sub MoveNext ' Increments the Position property value by one. myBindingManagerBase.Position += 1 End Sub Private Sub MovePrevious ' Decrements the Position property value by one. myBindingManagerBase.Position -= 1 End Sub Private Sub MoveFirst ' Goes to the first row in the list. myBindingManagerBase.Position = 0 End Sub Private Sub MoveLast ' Goes to the last row in the list. myBindingManagerBase.Position = _ myBindingManagerBase.Count - 1 End Sub
private void GetBindingManagerBase() { /* CustomersToOrders is the RelationName of a DataRelation. Therefore, the list maintained by the BindingManagerBase is the list of orders that belong to a specific customer in the DataTable named Customers, found in DataSet1. */ myBindingManagerBase = this.BindingContext[DataSet1, "Customers.CustomersToOrders"]; // Adds delegates to the CurrentChanged and PositionChanged events. myBindingManagerBase.PositionChanged += new EventHandler(BindingManagerBase_PositionChanged); myBindingManagerBase.CurrentChanged += new EventHandler(BindingManagerBase_CurrentChanged); } private void BindingManagerBase_PositionChanged (object sender, EventArgs e) { // Prints the new Position of the BindingManagerBase. Console.Write("Position Changed: "); Console.WriteLine(((BindingManagerBase)sender).Position); } private void BindingManagerBase_CurrentChanged (object sender, EventArgs e) { // Prints the new value of the current object. Console.Write("Current Changed: "); Console.WriteLine(((BindingManagerBase)sender).Current); } private void MoveNext() { // Increments the Position property value by one. myBindingManagerBase.Position += 1; } private void MovePrevious() { // Decrements the Position property value by one. myBindingManagerBase.Position -= 1; } private void MoveFirst() { // Goes to the first row in the list. myBindingManagerBase.Position = 0; } private void MoveLast() { // Goes to the last row in the list. myBindingManagerBase.Position = myBindingManagerBase.Count - 1; }
void GetBindingManagerBase() { /* CustomersToOrders is the RelationName of a DataRelation. Therefore, the list maintained by the BindingManagerBase is the list of orders that belong to a specific customer in the DataTable named Customers, found in DataSet1. */ myBindingManagerBase = this->BindingContext[DataSet1, "Customers.CustomersToOrders"]; // Adds delegates to the CurrentChanged and PositionChanged events. myBindingManagerBase->PositionChanged += gcnew EventHandler( this, &Form1::BindingManagerBase_PositionChanged ); myBindingManagerBase->CurrentChanged += gcnew EventHandler( this, &Form1::BindingManagerBase_CurrentChanged ); } void BindingManagerBase_PositionChanged( Object^ sender, EventArgs^ /*e*/ ) { // Prints the new Position of the BindingManagerBase. Console::Write( "Position Changed: " ); Console::WriteLine( (dynamic_cast<BindingManagerBase^>(sender))->Position ); } void BindingManagerBase_CurrentChanged( Object^ sender, EventArgs^ /*e*/ ) { // Prints the new value of the current object. Console::Write( "Current Changed: " ); Console::WriteLine( (dynamic_cast<BindingManagerBase^>(sender))->Current ); } void MoveNext() { // Increments the Position property value by one. myBindingManagerBase->Position = myBindingManagerBase->Position + 1; } void MovePrevious() { // Decrements the Position property value by one. myBindingManagerBase->Position = myBindingManagerBase->Position - 1; } void MoveFirst() { // Goes to the first row in the list. myBindingManagerBase->Position = 0; } void MoveLast() { // Goes to the last row in the list. myBindingManagerBase->Position = myBindingManagerBase->Count - 1; }
private void GetBindingManagerBase() { /* CustomersToOrders is the RelationName of a DataRelation. Therefore, the list maintained by the BindingManagerBase is the list of orders that belong to a specific customer in the DataTable named Customers, found in dataSet1. */ myBindingManagerBase = this.get_BindingContext().get_Item(dataSet1, "Customers.CustomersToOrders"); // Adds delegates to the CurrentChanged and PositionChanged events. myBindingManagerBase.add_PositionChanged(new EventHandler (BindingManagerBase_PositionChanged)); myBindingManagerBase.add_CurrentChanged(new EventHandler (BindingManagerBase_CurrentChanged)); } //GetBindingManagerBase private void BindingManagerBase_PositionChanged(Object sender, EventArgs e) { // Prints the new Position of the BindingManagerBase. Console.Write("Position Changed: "); Console.WriteLine(((BindingManagerBase)(sender)).get_Position()); } //BindingManagerBase_PositionChanged private void BindingManagerBase_CurrentChanged(Object sender, EventArgs e) { // Prints the new value of the current object. Console.Write("Current Changed: "); Console.WriteLine(((BindingManagerBase)(sender)).get_Current()); } //BindingManagerBase_CurrentChanged private void MoveNext() { // Increments the Position property value by one. myBindingManagerBase.set_Position(myBindingManagerBase.get_Position() + 1); } //MoveNext private void MovePrevious() { // Decrements the Position property value by one. myBindingManagerBase.set_Position(myBindingManagerBase.get_Position() - 1); } //MovePrevious private void MoveFirst() { // Goes to the first row in the list. myBindingManagerBase.set_Position(0); } //MoveFirst private void MoveLast() { // Goes to the last row in the list. myBindingManagerBase.set_Position(myBindingManagerBase.get_Count() - 1); } //MoveLast

System.Windows.Forms.BindingManagerBase
System.Windows.Forms.CurrencyManager
System.Windows.Forms.PropertyManager


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


BindingManagerBase メンバ
System.Windows.Forms 名前空間
BindingSource
BindingContext クラス
CurrencyManager
PropertyManager
BindingManagerBase コンストラクタ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)



Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


BindingManagerBase フィールド

名前 | 説明 | |
---|---|---|
![]() | onCurrentChangedHandler | CurrentChanged イベントのイベント ハンドラを指定します。 |
![]() | onPositionChangedHandler | PositionChanged イベントのイベント ハンドラを指定します。 |

関連項目
BindingManagerBase クラスSystem.Windows.Forms 名前空間
BindingSource
BindingContext クラス
CurrencyManager
PropertyManager
BindingManagerBase プロパティ


関連項目
BindingManagerBase クラスSystem.Windows.Forms 名前空間
BindingSource
BindingContext クラス
CurrencyManager
PropertyManager
BindingManagerBase メソッド

名前 | 説明 | |
---|---|---|
![]() | AddNew | 派生クラスでオーバーライドされると、基になるリストに新しい項目を追加します。 |
![]() | CancelCurrentEdit | 派生クラスでオーバーライドされると、現在の編集をキャンセルします。 |
![]() | EndCurrentEdit | 派生クラスでオーバーライドされると、現在の編集を終了します。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetItemProperties | オーバーロードされます。 データ ソースのプロパティ記述子のリストを取得します。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | RemoveAt | 派生クラスでオーバーライドされると、基になるリストから指定されたインデックスに対応する行を削除します。 |
![]() | ResumeBinding | 派生クラスでオーバーライドされると、データ連結を再開します。 |
![]() | SuspendBinding | 派生クラスでオーバーライドされると、データ連結を中断します。 |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | GetItemProperties | オーバーロードされます。 データ ソースのプロパティ記述子のリストを取得します。 |
![]() | GetListName | 派生クラスでオーバーライドされると、バインディングのためのデータを提供するリストの名前を取得します。 |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |
![]() | OnBindingComplete | BindingComplete イベントを発生させます。 |
![]() | OnCurrentChanged | CurrentChanged イベントを発生させます。 |
![]() | OnCurrentItemChanged | CurrentItemChanged イベントを発生させます。 |
![]() | OnDataError | DataError イベントを発生させます。 |
![]() | PullData | データ バインド コントロールからデータ ソースにデータをプルします。情報は返しません。 |
![]() | PushData | データ ソースからデータ バインド コントロールにデータをプッシュします。情報は返しません。 |
![]() | UpdateIsBinding | 派生クラスでオーバーライドされると、バインディングを更新します。 |

関連項目
BindingManagerBase クラスSystem.Windows.Forms 名前空間
BindingSource
BindingContext クラス
CurrencyManager
PropertyManager
BindingManagerBase メンバ
同じデータ ソースおよび同じデータ メンバに結合された Binding オブジェクトをすべて管理します。このクラスは抽象クラスです。
BindingManagerBase データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | onCurrentChangedHandler | CurrentChanged イベントのイベント ハンドラを指定します。 |
![]() | onPositionChangedHandler | PositionChanged イベントのイベント ハンドラを指定します。 |


名前 | 説明 | |
---|---|---|
![]() | AddNew | 派生クラスでオーバーライドされると、基になるリストに新しい項目を追加します。 |
![]() | CancelCurrentEdit | 派生クラスでオーバーライドされると、現在の編集をキャンセルします。 |
![]() | EndCurrentEdit | 派生クラスでオーバーライドされると、現在の編集を終了します。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetItemProperties | オーバーロードされます。 データ ソースのプロパティ記述子のリストを取得します。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | RemoveAt | 派生クラスでオーバーライドされると、基になるリストから指定されたインデックスに対応する行を削除します。 |
![]() | ResumeBinding | 派生クラスでオーバーライドされると、データ連結を再開します。 |
![]() | SuspendBinding | 派生クラスでオーバーライドされると、データ連結を中断します。 |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | GetItemProperties | オーバーロードされます。 データ ソースのプロパティ記述子のリストを取得します。 |
![]() | GetListName | 派生クラスでオーバーライドされると、バインディングのためのデータを提供するリストの名前を取得します。 |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |
![]() | OnBindingComplete | BindingComplete イベントを発生させます。 |
![]() | OnCurrentChanged | CurrentChanged イベントを発生させます。 |
![]() | OnCurrentItemChanged | CurrentItemChanged イベントを発生させます。 |
![]() | OnDataError | DataError イベントを発生させます。 |
![]() | PullData | データ バインド コントロールからデータ ソースにデータをプルします。情報は返しません。 |
![]() | PushData | データ ソースからデータ バインド コントロールにデータをプッシュします。情報は返しません。 |
![]() | UpdateIsBinding | 派生クラスでオーバーライドされると、バインディングを更新します。 |

名前 | 説明 | |
---|---|---|
![]() | BindingComplete | データ バインディング操作の完了時に発生します。 |
![]() | CurrentChanged | 現在バインドされている項目が変更されると発生します。 |
![]() | CurrentItemChanged | 現在バインドされている項目の状態が変更されたときに発生します。 |
![]() | DataError | Exception が BindingManagerBase によって処理された場合に発生します。 |
![]() | PositionChanged | Position プロパティの値が変更された後に発生します。 |

関連項目
BindingManagerBase クラスSystem.Windows.Forms 名前空間
BindingSource
BindingContext クラス
CurrencyManager
PropertyManager
- BindingManagerBaseのページへのリンク