Searching in a list view

Wednesday, February 18, 2009

Private Sub Searching(ByVal str As String, ByVal col As Integer, ByVal Lvws As ListView)

Dim i As Integer
Dim TotalCount As Long = 0
If Val(Lvws.Items.Count) > 0 Then
For Each itm As ListViewItem In Lvws.Items
For i = 0 To itm.SubItems.Count - 1
If UCase(Trim(itm.SubItems(i).Text)) Like "*" & UCase(Trim(str)) & "*" Then
' itm.SubItems(0).ForeColor = Color.Black
itm.SubItems(0).ForeColor = Color.Red
TotalCount += 1
lbintermediateWindow.Items.Add(str & ": Line No :" & itm.SubItems(0).Text)
Else
If chkignoreprevoiuscolor.Checked = True Then
If PreviouseColor = True Then
itm.SubItems(0).ForeColor = Color.Black
End If
End If
End If
Next
Next
End If
End Sub

0 comments

Post a Comment