Quote Originally Posted by Krool View Post
What use-case would be the "ItemData" ? What code you imagine to use ?
The use is to have a data associated to a selected list item. Usually it is a number that identifies the item.

For example:
Column "Select city", with these items:

Rome
Munich
Berlin
Paris
London
Madrid

But in the database each city is identified by a number, like 23, 45, 76, 88, 12, etc.
If the user selects Paris, we could want to store 88, not "Paris" as the user selection.

I have thought that as you have ColComboItems that defines the list with items separated by "|", you could also have ColComboItemsData and they could also be strings separated by "|".
There should be then a way to retrieve that selection, some other property I guess.

But anyway I should study what you said about multi-column, maybe it is already possible in another way.

I already have that issue solved in a couple of grids that I added to the current program so far, but I had to do this (let's continue with the example of selecting cities):
Store two arrays:

Code:
mCities_Names() As String
mCities_IDs() As Long
Then in the AfterEdit event of the grid, check the text of the cell that was selected against all the list:

Code:
Private Sub VBFlexGrid1_AfterEdit(ByVal Row As Long, ByVal Col As Long, ByVal Changed As Boolean)
    Dim iSelectedCityText As String
    Dim c As Long
    
    If Col = 5 Then ' select city column
        iSelectedCityText = VBFlexGrid1.TextMatrix(Row, Col)
        For c = 0 To UBound(mCities_Names)
            If mCities_Names(c) = iSelectedCityText Then
                VBFlexGrid1.RowData(Row) = mCities_IDs(c)
                Exit For
            End If
        Next
    End If
End Sub
(I actually didn't use RowData because I needed to store several combo selections, so I used hidden columns, but I did now to simplify the sample)