Why adding item to ListViewItem Take much longer second time aroun

G

Guest

Hi
When I add item first time to a ListViewItem control it does is very quick.But when I remove all item and add again it takes much longer. Can anyone tell me why is that and How I can improve the performance. Items may be 2000 or more.
 
H

Herfried K. Wagner [MVP]

* "=?Utf-8?B?QWw=?= said:
When I add item first time to a ListViewItem control it does is very quick.But when I remove all item and add again it takes much longer. Can anyone tell me why is that and How I can improve the performance. Items may be 2000 or more.

Did you already play around with the listview's 'BeginUpdate' and 'EndUpdate'
methods?
 
D

Denis

The problem is often the "sorting". Turn it off, load the data and then
turn it back on.

mylist.clear
mylist.sorting = SortOrder.none

'update'

mylist.sorting = SortOrder....'ascending or descending....what ever you
wish'

Denis
 
G

Guest

Hi Denis,
I did turn off sorting as you said after i clear but still the same. The first time it update a list of close to 3000 very fast the second time it is very slow.
Thanks
Al
 
G

Guest

I played with with 'BeginUpdate' and 'EndUpdate' still same performace. However i used the AddRange and that did it.
Thanks for all the comments
Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top