vb.net listbox- Remove ALL items that DON'T contain specific text -
i'm working listbox in vb.net , trying remove items listbox don't contain specific text @ click of button. here's code:
dim integer = 0 listboxprepublish.items.count - 1 if instr(listboxprepublish.items(i), "-8-") > 0 = false listboxprepublish.items.removeat(i) exit end if next
this removes 1 item @ time though. how can tweak remove items don't contain "-8-" @ once?
edit: in case asks, listbox items list growing rather large i'm adding sort feature users can widdle down options if want to. that's why i'm not filtering before adding listbox
here complete code backward loop mentioned in comments - should work:
for integer = listboxprepublish.items.count - 1 0 step -1 if not listboxprepublish.items(i).contains("-8-") listboxprepublish.items.removeat(i) end if next
Comments
Post a Comment