• Most of the Visual Basic tools we’ve studied can be used as bound,
or data-aware, tools (or controls). That means, certain tool properties can be
tied to a particular database field. To use a bound control, one or more data
controls must be on the form.
• Some bound data tools are:
Label - Can be used to provide display-only access to a specified
text data field.
Text Box - Can be used to provide read/write access to a specified
text data field. Probably, the most widely used data bound tool.
Check Box - Used to provide read/write access to a Boolean
Combo Box - Can be used to provide read/write access to a
text data field.
List Box - Can be used to provide read/write access to a text
Picture Box - Used to display a graphical image from a bitmap,
icon, or metafile on your form. Provides read/write access to a image/binary data
Image Box - Used to display a graphical image from a bitmap,
icon, or metafile on your form (uses fewer resources than a picture box). Provides
read/write access to a image/binary data field.
• There are also three ‘custom’ data aware tools, the DataCombo
(better than using the bound combo box), DataList (better than
the bound list box), and DataGrid tools, we will look at later.
• Bound Tool Properties:
DataChanged - Indicates whether a value displayed in a bound
control has changed.
DataField - Specifies the name of a field in the table pointed
to by the respective data control.
DataSource - Specifies which data control the control is bound
If the data in a data-aware control is changed and then the user changes focus
to another control or tool, the database will automatically be updated with the
new data (assuming LockType is set to allow an update).
• To make using bound controls easy, follow these steps (in order listed)
in placing the controls on a form:
Draw the bound control on the same form as the data control to which it will
Set the DataSource property. Click on the drop-down arrow
to list the data controls on your form. Choose one.
Set the DataField property. Click on the drop-down arrow to
list the fields associated with the selected data control records. Make your choice.
Set all other properties, as required.
By following these steps in order, we avoid potential data access errors.
• The relationships between the bound data control and the data control