Visual Basic: DataCombo/DataList Controls
DBList Control
See Also Example Properties Methods Events
The DBList control is a data bound list box which is automatically populated from a field in an attached Data control, and optionally updates a field in a related table of another Data control.
Syntax
DBList
Remarks
The DBList control differs from the standard ListBox control. While the ListBox control list is filled using the AddItem method, the DBList control is automatically filled with data from a field in the Recordset object of a Data control to which it is attached. The standard ListBox control must be populated manually by using the AddItem method. In addition, the DBList control has the ability to update a field within a related Recordset object which may reside in a different Data control.
The DBList control also supports an automated search mode that can quickly locate items in the list without additional code.
Shown below is a list of the properties you use to fill and manage the list, and bind the selected data to a Data control.
Property | Specifies |
DataSource | Name of Data control that is updated once a selection is made. |
DataField | Name of a field that is updated in the Recordset specified by the DataSource property. |
RowSource | Name of Data control used as a source of items for the list portion of the control. |
ListField | Name of a field in the Recordset specified by RowSource that is used to fill the list. DBList does not support fields of LongBinary type for the ListField property. |
BoundColumn | Name of a field in the Recordset specified by RowSource that is passed back to the DataField once a selection is made. DBList does not support fields of LongBinary type for the BoundColumn. |
BoundText | Text value of the BoundColumn field. Once a selection is made, this value is passed back to update the Recordset object specified by the DataSource and DataField properties. |
Text | Text value of the selected item in the list. |
MatchEntry | How the list is searched as the user types characters at run time. |
SelectedItem | The bookmark of the selected item in the Recordset specified by the RowSource property. |
VisibleCount | The number of items visible in the list (fully or partially). |
VisibleItems | An array of bookmarks with a maximum number of items equal to the VisibleCount property. |
The DBList control will automatically highlight an item in the list if the BoundText property becomes equal to the value of the field specified by the DataSource and DataField properties, such as when using a Data control to change the current record.