Answer the question
In order to leave comments, you need to log in
How to delete row in ListView that does not contain value in SubItem?
How to delete a row in a ListView that does not contain a value in a SubItem, and leave those that are equal to a variable?
For Each lvi As ListViewItem In ListViewZ.Items
If lvi.SubItems(4) <> Variables.UserCity Then
ListViewZ.Items.Remove()
End If
Next
Answer the question
In order to leave comments, you need to log in
For example, like this (all subelements are checked):
For Each lvi As ListViewItem In ListViewZ.Items
Dim found As Boolean = False
For Each si As ListViewItem.ListViewSubItem In lvi.SubItems
If si.Text = Variables.UserCity Then
found = True
Exit For
End If
Next
If Not found Then
lvi.Remove()
End If
Next
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question