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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListViewItem Remove and then reuse

Status
Not open for further replies.

dascandy

Programmer
Jul 19, 2005
6
NL
I have a filtered ListView. It removes items from the ListView itself and then adds them to an ArrayList for turning off the filter again.

The problem is that each time I use remove on the Items collection to remove the given item, it finalizes it and calls in the garbage collector. I'd like to reuse it however since that saves me a copy of the contents (which are non-trivially sized). Turning off the filter (adding the full arraylist to the item collection) takes around 2-3 seconds for a big amount, turning on the filter takes a minute.

Does anybody know how to speed this up or how to make ListView (from which I inherit) not delete the ListViewItem ?
 
I haven't checked but can't you make a listviewitem invisible?

ListviewItem item = myListview.Items[2];

item.Visible = false;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top