ComponentOne VSFlexGrid 8.0
ComboList Property

Returns or sets the list to be used as a drop-down when editing a cell.

Syntax

[form!]VSFlexGrid.ComboList[ = value As String ]

Remarks

The ComboList property controls the type of editor to be used when editing a cell. You may use a text box, drop-down list, drop-down combo, or an edit button to pop up custom editor forms.

To use the ComboList property, set the Editable property to True, and respond to the BeforeEdit event by setting the ComboList property to a string containing the proper options, described below.

Editing Options

To edit the cell using a regular text box, set the ComboList property to an empty string (""). You may also define an edit mask using the EditMask property.

To edit the cell using a drop-down list, set the ComboList property to a string containing the available options, separated by pipe characters ("|"). For example:

       ComboList = "ListItem 1|ListItem 2".

To edit the cell using a drop-down combo, set the ComboList property to a string containing the available options, separated by pipe characters ("|") and starting with a pipe character. For example:

       ComboList = "|ComboItem 1|ComboItem 2".

You can also use edit masks with drop-down combos using the EditMask property.

To display an edit button, set the ComboList property to a string containing an ellipsis (...). Edit buttons look like regular push buttons, aligned to the right of the cell, with an ellipsis as a caption. When the user clicks on the edit button, the control fires the CellButtonClick event. For example:

       ComboList = "...".

List Syntax

In addition to the basic list syntax described above, you may create lists that define multi-column drop-downs and translated lists (lists where each item has an associated numerical value).

To define multi-column lists, separate columns with tab characters (Chr(9), or vbTab). When you define a multi-column combo, only one column is displayed in the cell (the others are visible only on the drop-down list). By default, the first column is the one that is displayed in the cell. To display a different column instead, add a string with the format "*nnn;" to the first item, where nnn is the zero-based index of the column to be displayed.

To create a translated list, attach a numerical value to each list item by adding a string with format "#xxx;" to the beginning of the row, where xxx is the numerical value. This value may be read while editing the cell using the ComboData property.

For example:

  s = "|#10*1;Getz"   & vbTab & "Stan"  & vbTab & "1 Sansome" & vbTab & "972-4323" & _

      "|#20;Mindelis" & vbTab & "Nuno"  & vbTab & "2 5th"     & vbTab & "972-2321" & _

      "|#30;Davis"    & vbTab & "Miles" & vbTab & "1 High"    & vbTab & "345-2342" & _

      "|#40;Johnson"  & vbTab & "Bob"   & vbTab & "5 Hemlock" & vbTab & "342-2321"

  fa.ComboList = s

The code above will display a drop-down combo with four columns. The items will have associated data values 10, 20, 30, and 40. The value  displayed in the cells will be the one in column 1 (first name). Because the first character is a pipe, the box will be a drop-down combo, as opposed to a drop-down list box.

Note

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

 

What is the difference between ComboList and ColComboList?

The ComboList and ColComboList properties are closely related. They have the same function, and the syntax used to define the lists is exactly the same. There are two differences:

The ColComboList property applies to an entire column. It may be set once, when the control is loaded, and then you can forget about it. The ComboList property applies to the current cell only. To use it, you need to trap the BeforeEdit event and set ComboList to the list that is applicable to the call about to be edited.

The ColComboList property performs data translation. If data values are supplied, they are stored on the grid, not the actual string. The ComboList property does not perform this translation.

If all cells in a column are items picked from the same list, as is the case in most database applications, use the ColComboList property. You will not need to handle the BeforeEdit event and your code will be cleaner and more efficient. Also, you have the option of using data translation, which simplifies the code and increases data integrity.

If different cells in the same column have different lists, as for example in a property window, then you should use the ComboList property. You will need to trap the BeforeEdit event and you will have no automatic value translation.

Data Type

String

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback