I am trying to search through items in listview control in vb.net one by one. i.e When the user types in some keyworrk in the textbox and presses enter, the first found item in the listview should get highlighted, when he presses enter again, the second search item in the listview should get highlighted and so on.
I am not fully aware of how to keep track of already found items while searching. As of now , I am searching all the items in the listbx using the code :
If (e.KeyCode = Keys.Enter) Then
'START
ListView1.BeginUpdate()
ListView1.SelectedIndices.Clear()
If TextBox1.Text.Length > 0 Then
Dim lstOfStrings() As String = TextBox1.Text.Split(","c)
For Each s As String In lstOfStrings
For index As Integer = 0 To ListView1.Items.Count - 1
If s.Trim() <> "" Then
Dim item As String = ListView1.Items(index).ToString()
If item.IndexOf(s, StringComparison.CurrentCultureIgnoreCase) >= 0 Then
'ListView1.SelectedIndices.Add(index)
ListView1.Items(index).BackColor = Color.LightPink
End If
End If
Next
Next s
End If
ListView1.EndUpdate()
End if