Private Function FindLogic(ByVal LV As ListView, ByVal CIndex As Integer, ByVal SearchFor As String) As Integer
Dim idx As Integer
Dim It = From i In LV.Items Where i.index > CIndex And i.Text = SearchFor
If It.Count > 0 Then
idx = It(0).Index
Else
idx = -1
End If
Return idx
End Function
Dim idx As Integer = -1
For Each lvi As ListViewItem In Me.lvwData.Items
If lvi.SubItems(1).Text = "TextToSearchFor" Then
idx = lvi.Index
End If
Next
Private Function FindLogic(ByVal LV As ListView, ByVal CIndex As Integer, ByVal SearchFor As String) As Integer
Dim idx As Integer
Dim It = From i In LV.Items Where i.index > CIndex And i.SubItems(1).Text = SearchFor
If It.Count > 0 Then
idx = It(0).Index
Else
idx = -1
End If
Return idx
End Function
Private Function FindLogic(ByVal LV As ListView, ByVal CIndex As Integer, ByVal Column As Integer, ByVal SearchFor As String) As Integer
Dim idx As Integer
Dim It = From i In LV.Items Where i.index > CIndex And i.SubItems(Column).Text = SearchFor
If It.Count > 0 Then
idx = It(0).Index
Else
idx = -1
End If
Return idx
End Function
FindLogic(Listview1, 1, 1, "Dog")
FindLogic(Listview1, 1, LV.SelectedIndices(0), "Dog")