ComboBox Rowtag ListIndex

I’m trying to use combobox.Listindex to recover the value of RowTag method but when the user autocomplete the control the ListIndex value remains -1. If the user uses mouse it works fine. Any suggestions?

Sure. When you autocomplete then you must set the ListIndex.

How can I set the correct index for LastIndex? I’m sorry for this question I’m newbie around here.

My app works like that: I have a combobox, when I chose a item it fills a Listbox, then if I click in a row of this listbox it fills a set of TextFields to allow the user modify their contents. But if the user doesn’t go thru some combobox the ListIndex will not be updated. So everything became too complex!!

I had the same issue, so I modified my combobox subclass to search for the listindex and set it each time the user types a key
I still think it’s a bug of the last version as I don’t remember it worked like that some months ago.

As a workaround for the bug, pass the combobox to this method (after losing focus maybe):

Sub fixCombo(combo As Combobox)
  Dim i As Integer = -1
  If combo.ListIndex = -1 Then // Combobox wrongly returns -1 to auto-completed existing items
    i = combo.ListCount - 1  // Let's find it
    Do until i < 0
      If combo.Text = combo.List(i) Then Exit // Found in list
  End If
  If i >= 0 then combo.ListIndex = i // Fix List index
End Sub

This doesn’t solve the problem because as I mentioned above if the user doesn’t go thru the severals comboboxes in the windows than severals of them will not have the ListCount property updated. By the way I don’t know how to implement the routine above either.

Please forget the post above. The routine worked pretty well! Thanks a lot!