I have a text box and a '4' column ListView on a form.
When the user types into the text box I have got it to auto-complete and also highlight the selection in the listview.

What I would like it to also do is:
  • Check against a different column in the listview than the first column
  • Scroll the listview to show the selected item
  • Highlight the listview as in THIS threads post #1


I have used this code, from the above thread, which partially does what I am after:

vb Code:
  1. Private Sub txtSearch_Change()
  2.  
  3. 'Run through the available items and grab the first matching one.
  4. Dim LvwItm As ListItem
  5. Dim Strt As Integer
  6.  
  7. lvwMembers.FindItem(txtSearch.Text, , , 1).Selected = True
  8.  
  9. 'If something was chosen then we get the rest of it
  10. Strt = Len(txtSearch.Text)
  11. txtSearch.Text = lvwMembers.SelectedItem.Text
  12. txtSearch.SelStart = Strt
  13. txtSearch.SelLength = Len(txtSearch.Text) - Strt
  14.  
  15. End Sub