473,322 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Why adding item to ListViewItem Take much longer second time aroun

Al
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.

Nov 20 '05 #1
5 2494
* "=?Utf-8?B?QWw=?=" <Al@discussions.microsoft.com> scripsit:
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?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
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

Al wrote:
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.


Nov 20 '05 #3
Al
No I never used that. Can you elaborate please.
Thanks
Al

"Herfried K. Wagner [MVP]" wrote:
* "=?Utf-8?B?QWw=?=" <Al@discussions.microsoft.com> scripsit:
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?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #4
Al
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

"Denis" wrote:
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

Al wrote:
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.


Nov 20 '05 #5
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

"Herfried K. Wagner [MVP]" wrote:
* "=?Utf-8?B?QWw=?=" <Al@discussions.microsoft.com> scripsit:
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?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Eva | last post by:
Hi, I wanted to know how i can enter values into a specific column of a listview. I have tried the following code but this seems to enter all my values into the first column!!! Can anyone...
2
by: Ash Jones | last post by:
I trying to do nested items in a collection. I've got an item which one of the properties is subitems, which is a collection of item. can do the root level but if i do a subitem at design time i...
0
by: Andrew | last post by:
If item is a ListViewItem and str is a string, why do the following two lines not have the same effect ? item.SubItems.Add(new ListViewItem.ListViewSubItem()).Text = str;...
13
by: Maheshkumar.R | last post by:
hi groups, I have placed an listview control, i want to iterate thru the control and find the clicked event items. listView2.Items.Add(fname.ToString(), i); how i can perform the iteration...
3
by: Holmes | last post by:
Hello Ran into a bit of a problem here and have now exhausted my resources to getting this working What I am trying to do is load and show a simple vb form with a listbox in it Dim...
20
by: Ash Phillips | last post by:
Hi Everyone, I have this program I wrote in VB6 for family use. It's a DVD Database just for me to keep track of them cause I have so many lol. In VB6, I could add items to the ListView in...
6
by: George | last post by:
Hi all, How can I get the value stored from the selected item and subitems of a listview? Thanks in advance, George
14
by: Paul_Madden via DotNetMonster.com | last post by:
Basically I have a listbox to which I add simple STRING items- I have a progress bar which I increment whenever I populate another portion of the complete set of items I wish to add. What I observe...
9
by: Kadett | last post by:
Hi all, I have following problem: I'm creating a ListView (Details) control at run-time and filling it with some records (let's say 10 000). This operation seems to be quite fast, but when I call...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.