ListView Add() INCREDIBLY SLOW?

  • Thread starter Thread starter Steven Van Dyke
  • Start date Start date
S

Steven Van Dyke

I'm using a for loop to add about 5600 items to a list view. It's taking
about 5 minutes for the loop to complete. Is this normal? Would AddRange
work quicker? What's the quickest way to add items?

Thanks,

Steve
 
I tried a for loop to add my items to a ListView[] array, then used
AddRange(). Wow! Went from 5 minutes to like 3 seconds.

Steve
 
Gee, you think :D

Who would have thought that built in methods would be faster than home grown
loop hacks :D



Steven Van Dyke said:
I tried a for loop to add my items to a ListView[] array, then used
AddRange(). Wow! Went from 5 minutes to like 3 seconds.

Steve


Steven Van Dyke said:
I'm using a for loop to add about 5600 items to a list view. It's taking
about 5 minutes for the loop to complete. Is this normal? Would AddRange
work quicker? What's the quickest way to add items?

Thanks,

Steve
 
Always use the built in unless you have a good reason not to or can better
it :D


Mr.Tickle said:
Gee, you think :D

Who would have thought that built in methods would be faster than home grown
loop hacks :D



Steven Van Dyke said:
I tried a for loop to add my items to a ListView[] array, then used
AddRange(). Wow! Went from 5 minutes to like 3 seconds.

Steve


Steven Van Dyke said:
I'm using a for loop to add about 5600 items to a list view. It's taking
about 5 minutes for the loop to complete. Is this normal? Would AddRange
work quicker? What's the quickest way to add items?

Thanks,

Steve
 
Steven Van Dyke said:
I'm using a for loop to add about 5600 items to a list view. It's taking
about 5 minutes for the loop to complete. Is this normal? Would AddRange
work quicker? What's the quickest way to add items?

Have a look at the docs for the ListView's 'BeginUpdate' and 'EndUpdate'
methods. Notice that a lot of work has to be done when adding a new
item to the ListView control.
 
Back
Top