Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to remove a bunch of empty ListViewItems

Status
Not open for further replies.

DotNetter

Programmer
May 19, 2005
194
US
I have a ListView with several ListViewItems, each ListViewItem has an item and 4 SubItems. My ListView has a bunch of empty ListViewItems that I need to remove from the ListView.

Could someone please help me with a little sub into which I could pass a ListView and it will remove all but 5 blank ListViewItems? In other words, I want to leave any of my ListViewItems with any text in them - as well as 5 (if there are) blank ListViewItems.

Thanks,
Dot
 
this is just pseudo code, but I think something like this could work.

'Loop
If IsNull(lstViewName.ListItems(i).ListSubItems.Item) Then
lstViewName.ListItems.Remove (i)
End If
i=i+1
'End Loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top