Have a look at your function:
Private Function FindItem(ByVal LV As ListView, ByVal TextToFind As String) As Integer
For i As Integer = 0 To LV.Items.Count - 1
If Trim(LV.Items(i).Text) = Trim(TextToFind) Then
Return (i)
End If
For subitem As Integer = 0 To LV.Items(i).SubItems.Count - 1
If Trim(LV.Items(i).SubItems(subitem).Text) = Trim(TextToFind) Then
Return (i)
End If
Next
Next
Return -1
End Function
Use
ListOf(T)[
^] generic class.
Function FindItem(ByVal LV As ListView, ByVal TextToFind As String) AS List(Of Integer)
Dim IntList As New List(Of Integer)
IntList.Add(i)
Return IntList
End
You need to change code to your needs.