I'm not sure if this was already taken up in here, here is my dilema:
i have a textbox and i have a listview in a form, what i want to accomplish is when ever i type a value in a textbox it will search in the listview and hightlight the item, the code that i have is this:
the problem with this code, after i put one character in the textbox it work it search and highlight but it doesn't return the focus in the textbox for to complete the item to be search.
thanks in advance for any solution you may have and i do appreaciate in any advice.
i have a textbox and i have a listview in a form, what i want to accomplish is when ever i type a value in a textbox it will search in the listview and hightlight the item, the code that i have is this:
Code:
Private Sub Text12_Change()
FindItem Me.Text12.Text, 1
End Sub
Sub FindItem(strSearch As String, iSubItemIndex As Integer)
Dim i As Long
For i = 1 To Me.ListView6.ListItems.Count
If Me.ListView6.ListItems(i).SubItems(iSubItemIndex) Like "*" & strSearch & "*" Then 'you could also use the LIKE operator
Me.ListView6.ListItems(i).Selected = True
Me.ListView6.ListItems(i).EnsureVisible
Me.ListView6.SetFocus
Exit For
End If
Next
End Sub
the problem with this code, after i put one character in the textbox it work it search and highlight but it doesn't return the focus in the textbox for to complete the item to be search.
thanks in advance for any solution you may have and i do appreaciate in any advice.