ListView search

  • Thread starter Thread starter George
  • Start date Start date
G

George

Hello,

I want to update an item in a listview, to perform this I search the items
collection to

find the item with the corresponding text. Is there a more efficient way to
perform this? In a listview with 2000+ items I experience quite a
bottleneck... thanks.
 
take a look at this post:
http://www.dotnet247.com/247reference/msgs/13/68921.aspx

somehow the Contains of the listviewitemscollection does not work the way
you would want it to function (match based on text). as mentioned in the post,
you could use an arraylist (or hashtable) to store the text and index of your list
items and then do a search on the data structure ('binarysearch' method in case
of the arraylist, 'containskey' or 'containsvalue' method in case of hashtable) which
would be much faster. ofcourse, the downside is that you've added a storage
overhead. i'm not sure how bad that would be in your case - but you'll have to
compromise one for the other..

hope this helps..

hope this helps..
 
Thanks for your response ISK, I think that there are many little things
missing from the framework and that's annoying (especially with such a good
overall work). Let's hope that at the future versions most of them will be
history ;-)
 
Back
Top