Listview highlighting

Johnson

Well-known member
Joined
Mar 6, 2009
Messages
158
Programming Experience
Beginner
i have a listview and also i have a text file with stored entrys in.

VB.NET:
    Private Sub HighLightSafeEntrys()
        Dim SafeEntries() As String = _SafeList.GetEntries()

        For Each line As String In SafeEntries

            Dim processName As String = line.Split("*"c)(2)
            Dim Name = (From item In lvDisplayRunningProcesses.Items _
                       Let i = DirectCast(item, ListViewItem) _
                       Where i.SubItems(0).Text = processName _
                                    Select i.SubItems(0).Text).ToArray

        Next
    End Sub

the first column is the name that the split function looks for.

How can i highlight this row if a entry is found in my text file?
 
When you create the ListView items you can assign them a Name, which can be used with the Items.Find function. Otherwise you would have to loop/query the Items to find it. The ListViewItem can be selected by setting the Selected property. To have the whole row selected set FullRowSelect property of the ListView.
 
Back
Top