Defining a Lookup List Column
Go Up to Creating a Customized Grid
You can create a column that displays a drop-down list of values, similar to a lookup combo box control. To specify that the column acts like a combo box, set the ButtonStyle property of the column to cbsAuto. Once you populate the list with values, the grid automatically displays a combo box-like drop-down button when a cell of that column is in edit mode.
There are two ways to populate that list with the values for users to select:
- You can fetch the values from a lookup table. To make a column display a drop-down list of values drawn from a separate lookup table, you must define a lookup field in the dataset. Once the lookup field is defined, set the FieldName of the column to the lookup field name. The drop-down list is automatically populated with lookup values defined by the lookup field.
- You can specify a list of values explicitly at design time. To enter the list values at design time, double-click the PickList property for the column in the Object Inspector. This brings up the String List editor, where you can enter the values that populate the pick list for the column.
By default, the drop-down list displays 7 values. You can change the length of this list by setting the DropDownRows property.
Note: To restore a column with an explicit pick list to its normal behavior, delete all the text from the pick list using the String List editor.