Clear the rows only? listview1.Items.Clear (or -> instead of .)
Takes only 1.5s even with 100 columns and 10,000 rows.
Didn't test with more data because only filling takes 25s. I think much
more a user should not have to handle.
Usually, when adding a larger number of items, I'd suggest to call
listview1.beginupdate before and listview1.endupdate afterwards. However,
this doesn't make any difference when calling Clear. 1.5s with or without
begin/endupdate.
Have you had a look at the remarks section of the LVN_DELETEALLITEMS
message? Are you perhaps getting a LVN_DELETEITEM notification message
for each item?
Do you have an event handler that gets called when items are removed
or when the selection changes? If so, it probably gets called for
each row that is removed, and if it does a significant amount of
processing that might account for it.
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.