ControlBindingsCollectionとは? わかりやすく解説

ControlBindingsCollection イベント


パブリック イベントパブリック イベント

  名前 説明
パブリック イベント CollectionChanged  コレクション変更され場合発生します。 ( BindingsCollection から継承されます。)
パブリック イベント CollectionChanging  コレクション変更される直前発生します。 ( BindingsCollection から継承されます。)
参照参照

関連項目

ControlBindingsCollection クラス
System.Windows.Forms 名前空間

ControlBindingsCollection クラス

コントロールデータ連結コレクション表します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Class ControlBindingsCollection
    Inherits BindingsCollection
Dim instance As ControlBindingsCollection
public class ControlBindingsCollection : BindingsCollection
public ref class ControlBindingsCollection
 : public BindingsCollection
public class ControlBindingsCollection extends
 BindingsCollection
public class ControlBindingsCollection extends
 BindingsCollection
解説解説
使用例使用例

5 つコントロール (4 つTextBox コントロール1 つの DateTimePicker コントロール) の ControlBindingsCollection に、Binding オブジェクト追加するコード例次に示しますControlBindingsCollection には、Control クラスDataBindings プロパティ使用してアクセスます。

Protected Sub BindControls()
    ' Create two Binding objects for the first two TextBox 
    ' controls. The data-bound property for both controls 
    ' is the Text property. The data source is a DataSet 
    ' (ds). The data member is the navigation path: 
    ' TableName.ColumnName. 
    textBox1.DataBindings.Add _
       (New Binding("Text", ds,
 "customers.custName"))
    textBox2.DataBindings.Add _
       (New Binding("Text", ds,
 "customers.custID"))
    
    ' Bind the DateTimePicker control by adding a new Binding. 
    ' The data member of the DateTimePicker is a navigation path:
    ' TableName.RelationName.ColumnName. 
    DateTimePicker1.DataBindings.Add _
       (New Binding("Value", ds,
 "customers.CustToOrders.OrderDate"))
    
    ' Create a new Binding using the DataSet and a 
    ' navigation path(TableName.RelationName.ColumnName).
    ' Add event delegates for the Parse and Format events to 
    ' the Binding object, and add the object to the third 
    ' TextBox control's BindingsCollection. The delegates 
    ' must be added before adding the Binding to the 
    ' collection; otherwise, no formatting occurs until 
    ' the Current object of the BindingManagerBase for 
    ' the data source changes. 
    Dim b As New Binding("Text",
 ds, "customers.custToOrders.OrderAmount")
    AddHandler b.Parse, AddressOf CurrencyStringToDecimal
    AddHandler b.Format, AddressOf DecimalToCurrencyString
    textBox3.DataBindings.Add(b)
    
    ' Bind the fourth TextBox to the Value of the 
    ' DateTimePicker control. This demonstates how one control
    ' can be data-bound to another.
    textBox4.DataBindings.Add("Text", DateTimePicker1,
 "Value")
    
    ' Get the BindingManagerBase for the textBox4 Binding.
    Dim bmText As BindingManagerBase = Me.BindingContext(DateTimePicker1)
    
    ' Print the Type of the BindingManagerBase, which is 
    ' a PropertyManager because the data source
    ' returns only a single property value. 
    Console.WriteLine(bmText.GetType().ToString())
    
    ' Print the count of managed objects, which is one.
    Console.WriteLine(bmText.Count)
    
    ' Get the BindingManagerBase for the Customers table. 
    bmCustomers = Me.BindingContext(ds, "Customers")
    
    ' Print the Type and count of the BindingManagerBase.
    ' Because the data source inherits from IBindingList,
    ' it is a RelatedCurrencyManager (a derived class of
    ' CurrencyManager). 
    Console.WriteLine(bmCustomers.GetType().ToString())
    Console.WriteLine(bmCustomers.Count)
    
    ' Get the BindingManagerBase for the Orders of the current
    ' customer using a navigation path: TableName.RelationName. 
    bmOrders = Me.BindingContext(ds, "customers.CustToOrders")
End Sub    
protected void BindControls()
{
   /* Create two Binding objects for the first two TextBox 
   controls. The data-bound property for both controls 
   is the Text property. The data source is a DataSet 
   (ds). The data member is the navigation path: 
   TableName.ColumnName. */
   textBox1.DataBindings.Add(new Binding
   ("Text", ds, "customers.custName"));
   textBox2.DataBindings.Add(new Binding
   ("Text", ds, "customers.custID"));
      
   /* Bind the DateTimePicker control by adding a new Binding.
 
   The data member of the DateTimePicker is a navigation path:
   TableName.RelationName.ColumnName. */
   DateTimePicker1.DataBindings.Add(new 
   Binding("Value", ds, "customers.CustToOrders.OrderDate"));

   /* Create a new Binding using the DataSet
 and a 
   navigation path(TableName.RelationName.ColumnName).
   Add event delegates for the Parse and Format events to 
   the Binding object, and add the object to the third 
   TextBox control's BindingsCollection. The delegates 
   must be added before adding the Binding to the 
   collection; otherwise, no formatting occurs until 
   the Current object of the BindingManagerBase for 
   the data source changes. */
   Binding b = new Binding
   ("Text", ds, "customers.custToOrders.OrderAmount");
   b.Parse+=new ConvertEventHandler(CurrencyStringToDecimal);
   b.Format+=new ConvertEventHandler(DecimalToCurrencyString);
   textBox3.DataBindings.Add(b);

   /*Bind the fourth TextBox to the Value of the 
   DateTimePicker control. This demonstates how one control
   can be data-bound to another.*/
   textBox4.DataBindings.Add("Text", DateTimePicker1,"Value");

   // Get the BindingManagerBase for the textBox4 Binding.
   BindingManagerBase bmText = this.BindingContext
   [DateTimePicker1];

   /* Print the Type of the BindingManagerBase, which is 
   a PropertyManager because the data source
   returns only a single property value. */
   Console.WriteLine(bmText.GetType().ToString());

   // Print the count of managed objects, which is one.
   Console.WriteLine(bmText.Count);

   // Get the BindingManagerBase for the Customers table. 
   bmCustomers = this.BindingContext [ds, "Customers"];

   /* Print the Type and count of the BindingManagerBase.
   Because the data source inherits from IBindingList,
   it is a RelatedCurrencyManager (a derived class of
   CurrencyManager). */
   Console.WriteLine(bmCustomers.GetType().ToString());
   Console.WriteLine(bmCustomers.Count);
   
   /* Get the BindingManagerBase for the Orders of the current
   customer using a navigation path: TableName.RelationName. */
 
   bmOrders = this.BindingContext[ds, "customers.CustToOrders"];
}
protected:
   void BindControls()
   {
      /* Create two Binding objects for the first two TextBox
 
         controls. The data-bound property for both controls 
         is the Text property. The data source is a DataSet 
         (ds). The data member is the navigation path: 
         TableName.ColumnName. */
      textBox1->DataBindings->Add( gcnew Binding(
         "Text",ds,"customers.custName" ) );
      textBox2->DataBindings->Add( gcnew Binding(
         "Text",ds,"customers.custID" ) );
      
      /* Bind the DateTimePicker control by adding a new Binding.
 
         The data member of the DateTimePicker is a navigation path:
         TableName.RelationName.ColumnName. */
      DateTimePicker1->DataBindings->Add( gcnew Binding(
         "Value",ds,"customers.CustToOrders.OrderDate" ) );
      
      /* Create a new Binding using the DataSet
 and a 
         navigation path(TableName.RelationName.ColumnName).
         Add event delegates for the Parse and Format events to
 
         the Binding object, and add the object to the third 
         TextBox control's BindingsCollection. The delegates 
         must be added before adding the Binding to the 
         collection; otherwise, no formatting occurs until 
         the Current object of the BindingManagerBase for 
         the data source changes. */
      Binding^ b = gcnew Binding(
         "Text",ds,"customers.custToOrders.OrderAmount" );
      b->Parse += gcnew ConvertEventHandler(
         this, &Form1::CurrencyStringToDecimal );
      b->Format += gcnew ConvertEventHandler(
         this, &Form1::DecimalToCurrencyString );
      textBox3->DataBindings->Add( b );
      
      /*Bind the fourth TextBox to the Value of the 
         DateTimePicker control. This demonstates how one control
         can be data-bound to another.*/
      textBox4->DataBindings->Add( "Text", DateTimePicker1, "Value"
 );
      
      // Get the BindingManagerBase for the textBox4 Binding.
      BindingManagerBase^ bmText = this->BindingContext[
         DateTimePicker1 ];
      
      /* Print the Type of the BindingManagerBase, which is 
         a PropertyManager because the data source
         returns only a single property value. */
      Console::WriteLine( bmText->GetType() );
      
      // Print the count of managed objects, which is one.
      Console::WriteLine( bmText->Count );
      
      // Get the BindingManagerBase for the Customers table. 
      bmCustomers = this->BindingContext[ds, "Customers"];
      
      /* Print the Type and count of the BindingManagerBase.
         Because the data source inherits from IBindingList,
         it is a RelatedCurrencyManager (a derived class of
         CurrencyManager). */
      Console::WriteLine( bmCustomers->GetType() );
      Console::WriteLine( bmCustomers->Count );
      
      /* Get the BindingManagerBase for the Orders of the current
         customer using a navigation path: TableName.RelationName.
 */
      bmOrders = this->BindingContext[ds, "customers.CustToOrders"];
   }
protected void BindControls()
{
    /*  Create two Binding objects for the first two TextBox 
        controls. The data-bound property for both controls 
        is the Text property. The data source is a DataSet 
        (ds). The data member is the navigation path: 
        TableName.ColumnName. 
     */
    textBox1.get_DataBindings().
        Add(new Binding("Text", ds, "customers.custName"));
    textBox2.get_DataBindings().
        Add(new Binding("Text", ds, "customers.custID"));

    /*  Bind the DateTimePicker control by adding a new Binding.
 
        The data member of the DateTimePicker is a navigation path:
        TableName.RelationName.ColumnName. 
     */
    dateTimePicker1.get_DataBindings().
        Add(new Binding("Value", ds,"customers.CustToOrders.OrderDate"));

    /*  Create a new Binding using the DataSet
 and a 
        navigation path(TableName.RelationName.ColumnName).
        Add event delegates for the Parse and Format events to
 
        the Binding object, and add the object to the third 
        TextBox control's BindingsCollection. The delegates 
        must be added before adding the Binding to the 
        collection; otherwise, no formatting occurs until 
        the Current object of the BindingManagerBase for 
        the data source changes. 
     */
    Binding b = new Binding("Text", 
        ds, "customers.custToOrders.OrderAmount");

    b.add_Parse(new ConvertEventHandler(CurrencyStringToDecimal));
    b.add_Format(new ConvertEventHandler(DecimalToCurrencyString));
    textBox3.get_DataBindings().Add(b);

    /*  Bind the fourth TextBox to the Value of the 
        DateTimePicker control. This demonstates how one control
        can be data-bound to another.
     */
    textBox4.get_DataBindings().Add("Text", dateTimePicker1, "Value");

    // Get the BindingManagerBase for the textBox4 Binding.
    BindingManagerBase bmText 
        = this.get_BindingContext().get_Item(dateTimePicker1);

    /*  Print the Type of the BindingManagerBase, which is 
        a PropertyManager because the data source
        returns only a single property value. 
     */
    Console.WriteLine(bmText.GetType().ToString());

    // Print the count of managed objects, which is one.
    Console.WriteLine(bmText.get_Count());

    // Get the BindingManagerBase for the Customers table. 
    bmCustomers = this.get_BindingContext().get_Item(ds, "Customers");

    /*  Print the Type and count of the BindingManagerBase.
        Because the data source inherits from IBindingList,
        it is a RelatedCurrencyManager (a derived class of
        CurrencyManager). 
     */
    Console.WriteLine(bmCustomers.GetType().ToString());
    Console.WriteLine(bmCustomers.get_Count());

    /*  Get the BindingManagerBase for the Orders of the current
        customer using a navigation path: TableName.RelationName.
 
     */
    bmOrders 
        = this.get_BindingContext().get_Item(ds, "customers.CustToOrders");
} //BindControls
継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.Windows.Forms.BaseCollection
       System.Windows.Forms.BindingsCollection
        System.Windows.Forms.ControlBindingsCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ControlBindingsCollection コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

指定したバインドできるコントロール使用して ControlBindingsCollection クラス新しインスタンス初期化します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Sub New ( _
    control As IBindableComponent _
)
Dim control As IBindableComponent

Dim instance As New ControlBindingsCollection(control)
public ControlBindingsCollection (
    IBindableComponent control
)
public:
ControlBindingsCollection (
    IBindableComponent^ control
)
public ControlBindingsCollection (
    IBindableComponent control
)
public function ControlBindingsCollection (
    control : IBindableComponent
)

パラメータ

control

バインディング コレクション属する IBindableComponent。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ControlBindingsCollection クラス
ControlBindingsCollection メンバ
System.Windows.Forms 名前空間

ControlBindingsCollection プロパティ


ControlBindingsCollection メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Add オーバーロードされますBindingコレクション追加します
パブリック メソッド Clear バインディングコレクション消去します。
パブリック メソッド CopyTo  指定したコピー先の Array インデックス開始位置として、現在の 1 次元 Arrayすべての要素指定した 1 次元 Arrayコピーします。 ( BaseCollection から継承されます。)
パブリック メソッド CreateObjRef  リモート オブジェクトとの通信使用するプロキシ生成必要な情報をすべて格納しているオブジェクト作成します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 ( Object から継承されます。)
パブリック メソッド GetEnumerator  コレクションメンバ反復処理できるオブジェクト取得します。 ( BaseCollection から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 ( Object から継承されます。)
パブリック メソッド GetLifetimeService  対象インスタンス有効期間ポリシー制御する現在の有効期間サービス オブジェクト取得します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド InitializeLifetimeService  対象インスタンス有効期間ポリシー制御する有効期間サービス オブジェクト取得します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド Remove 指定した Bindingコレクションから削除します
パブリック メソッド RemoveAt 指定したインデックスBinding削除します
パブリック メソッド ToString  現在の Object を表す String返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

ControlBindingsCollection クラス
System.Windows.Forms 名前空間

ControlBindingsCollection メンバ

コントロールデータ連結コレクション表します

ControlBindingsCollection データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド ControlBindingsCollection 指定したバインドできるコントロール使用して ControlBindingsCollection クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
( プロテクト プロパティ参照)
  名前 説明
パブリック プロパティ Count  コレクション内のバインディング合計数を取得します。(BindingsCollection から継承されます。)
パブリック プロパティ IsReadOnly  コレクション読み取り専用かどうかを示す値を取得します。(BaseCollection から継承されます。)
パブリック プロパティ IsSynchronized  ICollection へのアクセス同期がとられているかどうかを示す値を取得します。(BaseCollection から継承されます。)
パブリック プロパティ Item オーバーロードされます指定した Bindingコレクションから取得します
パブリック プロパティ SyncRoot  BaseCollection へのアクセス同期するために使用できるオブジェクト取得します。(BaseCollection から継承されます。)
プロテクト プロパティプロテクト プロパティ
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Add オーバーロードされますBindingコレクション追加します
パブリック メソッド Clear バインディングコレクション消去します。
パブリック メソッド CopyTo  指定したコピー先の Array インデックス開始位置として、現在の 1 次元 Arrayすべての要素指定した 1 次元 Arrayコピーします。 (BaseCollection から継承されます。)
パブリック メソッド CreateObjRef  リモート オブジェクトとの通信使用するプロキシ生成必要な情報をすべて格納しているオブジェクト作成します。 (MarshalByRefObject から継承されます。)
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 (Object から継承されます。)
パブリック メソッド GetEnumerator  コレクションメンバ反復処理できるオブジェクト取得します。 (BaseCollection から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 (Object から継承されます。)
パブリック メソッド GetLifetimeService  対象インスタンス有効期間ポリシー制御する現在の有効期間サービス オブジェクト取得します。 (MarshalByRefObject から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド InitializeLifetimeService  対象インスタンス有効期間ポリシー制御する有効期間サービス オブジェクト取得します。 (MarshalByRefObject から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド Remove 指定した Bindingコレクションから削除します
パブリック メソッド RemoveAt 指定したインデックスBinding削除します
パブリック メソッド ToString  現在の Object を表す String返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
パブリック イベントパブリック イベント
  名前 説明
パブリック イベント CollectionChanged  コレクション変更され場合発生します。(BindingsCollection から継承されます。)
パブリック イベント CollectionChanging  コレクション変更される直前発生します。(BindingsCollection から継承されます。)
参照参照

関連項目

ControlBindingsCollection クラス
System.Windows.Forms 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からControlBindingsCollectionを検索した結果を表示しています。
Weblioに収録されているすべての辞書からControlBindingsCollectionを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からControlBindingsCollection を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ControlBindingsCollection」の関連用語

ControlBindingsCollectionのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ControlBindingsCollectionのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS