ColComboList Property

Returns or sets the list to be used as a drop-down on the specified column.

Syntax

[form!]VSFlexGrid.ColComboList(Col As Long)[ = value As String ]

Remarks

This property is similar to the ComboList property, except it applies to entire columns. This is often more convenient that using the ComboList property because you may set the ColComboList property once for each column, whereas the ComboList property normally needs to be set in the BeforeEdit event.

Another difference is that the ColComboList property can be configured to acts as a data dictionary, allowing you to map numeric values to string entries. The control will hold the numeric values, but will display the associated strings. This mapping is useful for displaying numeric fields that correspond to entries on a list or on a database table.

For example, you may have a column that holds the employee type, which could be one of the following: "Full-time", "Part-time", "Contractor", "Intern", or "Other". These values will often come from a database, where they will have a unique entry ID. These should be included in the ColComboList string using the following syntax:

fg.ColComboList(1) = "#1;Full time|#23;Part time|#65;Contractor|#78;Intern|#0;Other"

After editing, the column will contain the numbers for each entry (that is, 1 for full-time, 23 for part-time, 65 for contractor, and so on). The control will display the full text, however. (This translation is optional. If you omit the entry ID, the control will store the full text.)

You may retrieve the number using the Cell(flexcpText), Text, or TextMatrix properties. You may retrieve the associated text using the Cell(flexcpTextDisplay) property. For example:

    Debug.Print fg.Cell(flexcpText, fg.Row, 1), fg.Cell(flexcpTextDisplay, fg.Row, 1)

        23         Part time

You may use the BuildComboList method to create a ColComboList property automatically from a recordset.

For more details on list syntax, including multi-column lists, see the ComboList property.

When setting this property, the Col parameter should be set to a value between zero and Cols - 1 to set the ColComboList of a given column, or to -1 to set the ColComboList of all columns.

Note

The value -1 is reserved and may not be used as an entry ID.

Data Type

String

See Also

VSFlexGrid Control