Visual Basic Concepts
The DataCombo and DataList controls strongly resemble the standard list box and combo box controls, but there are some important differences that give them great flexibility and usefulness in database applications. Both controls can be automatically filled from a database field from the data control to which they are bound. In addition, they can optionally pass a selected field to a second data control, making them ideal for "lookup table" applications.
Like their built-in counterparts, the main difference between the DataList and the DataCombo controls is that the DataCombo box control provides a text box into whose contents may be edited.
For More Information For an explanation of the DataList and DataCombo controls' ability to link database tables, see "Linking Two Tables using the DataCombo and DataList Controls." To build a simple application using linked tables, see "Creating a Simple DataCombo Application."
Some important properties of the DataList and DataCombo controls include:
Property | Description |
BoundText | Contains the value of the field named in the BoundColumn property. |
SelectedItem | Returns a bookmark for the row of a selected item. |
MatchEntry | Enables extended search mode for locating items in a list generated by the DataCombo control. |
IntegralHeight | Sizes the control to display an exact number of complete rows. |
VisibleCount | Specifies the number of visible items in a list. |
Note The DataFormat property of the DataCombo control is an Extender property. Therefore it's always visible on the property sheet and can be set in code. However the DataCombo control only formats the top item in its list. This can be disconcerting to the end user who sees a formatted top item, but is only given a list of unformatted items to select from. The formatted item may also mislead end users who assume the item will be entered in the database as formatted. For these reasons, it's advisable to not set the DataFormat property when using the DataCombo control.
For More Information To try a step-by-step tutorial that demonstrates the use of the BoundText property, see "Creating a DataGrid Linked to a DataList Control." For a complete list of properties and methods of these controls, see "DataList Control" and "DataCombo Control."