BindingCollection Object (VB6) |
The BindingCollection object—as the name suggests—is a collection of Binding objects. The BindingCollection object plays a central role in the new data-binding technology in VB6, allowing you to automatically map data fields to standard form controls and to specify formatting for those data. Your application can have any number of BindingCollection objects, each referring to a distinct data member provided by a data source such as an ADO recordset or a VB data source class. The Binding objects held within the class represent the individual mapping of consumer control property to data provider field, a relationship created using the BindingCollections Add method.
The relationship between the various data binding elements is shown in Figure 7.1.
For an overview of data-binding objects, including the library reference needed to access the object model, see the Data Binding Objects entry.
Yes
Count
Data Type: Long
The number of Binding objects in the collection.
DataMember
Type: DataMember
An optional string specifying the data member to use from the data source. This is useful where the source provides more than one data member. A DataSource application can provide many data members; you need to create a BindingCollection object for each data member to which you wish to bind.
DataSource
Data Type: DataSource
A valid data source object such as an ADO recordset or a VB class object set to vbDataSource. The DataSource is distinct from the DataMember; the DataSource is the application providing the data, whereas the DataMember is a discrete recordset within the DataSource.
Item
Data Type: Binding Object
Returns a Binding object. If you use a key string in the Add method, you can also access the Binding object by key, as in:
obcAuthors.Item("fname")
UpdateMode
Type: UpdateMode enumerated constant (see below)
Specifies at what stage the data source is updated. However, if you open a recordset as read-only, no update occurs.
vbUpdateWhenPropertyChanges
Value: 1
Don't use this constant when dealing with VB class data sources. I found it disabled the Binding object's DataChanged property.
vbUpdateWhenRowChanges
Value: 2
The recordset is updated.
vbUsePropertyAttributes
Value: 0
Not relevant to class data sources.
18.224.52.200