Binding Data with the DataBinder Control

The DataBinder control binds a field from a recordset to the property of another control. When a property is bound, it is automatically set to the value of the field in the current record.

The following steps show how to use the DataBinder control in the Designer. (You must have already added the data controls to the Toolbox.) This example binds the text property of an Edit control.

To bind a data field to a property with the DataBinder control

  1. Add a DataSource control to the form to retrieve the data. For information on how to do this, see Retrieving a Set of Records.

  2. Add an Edit control and a DataBinder control to the form.

    Note   Like the DataSource control, the DataBinder control is not displayed when the form is run, since it only manages the binding and does not actually display data.

  3. To associate the recordset from the DataSource control with the DataBinder control, set the DataBinder controlÆs the dataSource property. From the drop-down list, select the name of the DataSource control.

  4. The bindings property of the DataBinder control identifies the bindings that have been currently defined. To set this property, right-click the DataBinder control and click Properties on the shortcut menu. (You can also click the Properties button in the Properties window.) Use the controlÆs design page to define the bindings:

You can now add a DataNavigator control to the form to navigate through the records of data. For more information about the DataBinder control and for related programming examples, see DataBinder Component.