ComboCount Property

Returns the number of items in the editor's combo list.

Syntax

val& = [form!]VSFlexGrid.ComboCount

Remarks

The ComboCount property allows you to customize editing when using drop-down or combo lists. It is valid only while the user is editing a value using a list.

For example, the code below traps the HOME key and selects a specific name instead of moving the cursor to the first item on the list. The example also illustrates the use of other related properties, ComboItem and ComboIndex.

Private Sub fg_KeyDownEdit(ByVal Row As Long, _

                                               ByVal Col As Long, _

            KeyCode As Integer, ByVal Shift As Integer)

        Dim i As Long

        If Col = 2 And KeyCode = vbKeyHome Then

            KeyCode = 0 ' eat the key           

                     For i = 0 To fg.ComboCount - 1 ' select "Cedric"

                If fg.ComboItem(i) = "Cedric" Then

                    fg.ComboIndex = i

                    Exit For

                End If

        Next

        End If

    End Sub

Data Type

Long

See Also

VSFlexGrid Control