Visual Basic Reference

Add Method (BindingCollection)

See Also    Example    Applies To

Adds a Binding object to the BindingCollection object.

Syntax

object.Add(object, PropertyName, DataField, DataFormat, Key)

The Add method syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
object Required. The control or other data consumer which will be bound.
PropertyName Required. The property of the data consumer to which the data field will be bound.
DataField Required. The column of the data source that will be bound to the property specified in the PropertyName argument.
DataFormat Optional. A DataFormat object or a reference to a DataFormat variable that will be used to format the bound property.
Key Optional. A unique string that identifies the member of the collection.

Remarks

The Binding object represents a property of an object bound to a data field of a data source. Use the BindingCollection object to bind a data source that has no design time interface, such as a Class configured as a data source, to a data consumer. You can also bind an OLE Simple Provider (OSP) data source to a data consumer using the Binding object.

You cannot use the Binding object to bind a complex bound control (such as the DataGrid control) to a data source. Instead, simply set the DataSource property of the control to the source.