At design time, bind the DBList control to 2 Data controls.
DataSource gives the Data control that determines the record that is bound to the DBList. DataField gives the field displayed by the DBList. In this example, DataSource is the EmployeeData Data control bound to the Employees table, and DataField is Department. When the EmployeeData control moves to a new Employees record, the DBList control displays that employee's Department value.
RowSource gives the Data control that determines the values allowed by the DBList. ListField gives the Data control's field used to fill the list. In this example, RowSource is the DepartmentName Data control bound to the Departments table, and ListField is DepartmentName. The DBList allows the values contained in the Departments table's DepartmentName field.
Run the program. As you use the EmployeeData control at the bottom to move through the employee records, the program displays the employees' names at the top. The DBList displays each employee's Department value. Click a list entry to change the value. Note that the new value remains when you move to another record and back, and when you close and restart the program.
|