Why adding item to ListViewItem Take much longer second time aroun

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
* "=?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?
 
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
 
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
 
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
 
Back
Top