Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't recommend using a background thread to do this. The sole action your background thread takes is updating the UI so every call it makes is to the UI - there's nothing that really happens in the background that doesn't involve the UI.</p> <p>Off the top of my head I can't think of anything that would make this faster than a straight <code>for</code> loop through all items. If anything, using the background thread makes things slower because each record update has to be invoked on the UI thread.</p> <p>There may be a better solution that I don't think of now but I'd just do this:</p> <pre><code>list.BeginUpdate (); for(int i = 0; i &lt; list.Items.Count; i++) { list.Items[i].SubItem[3].Text = ""; } list.EndUpdate (); </code></pre> <p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.beginupdate.aspx" rel="nofollow"><code>BeginUpdate()</code></a> / <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.endupdate.aspx" rel="nofollow"><code>EndUpdate()</code></a> functions can be used to suspend UI updates of the control while its data is being modified in bulk - this speeds up the loop considerably.</p> <p>As an alternative, you can try updating a copy of the data shown in the list and then removing all items and adding the updated items using <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.listviewitemcollection.addrange.aspx" rel="nofollow"><code>AddRange</code></a>.</p> <p>I'm not sure which solution would be faster (likely the direct update) but you should really consider either using a virtual list or showing fewer items in the list. Very few users can really deal with 20K records in a list - even scrolling through it must be a pain to find a specific item.</p> <p>If you use <code>VirtualMode</code> you can keep all your data in your own list and only show items that actually fit in the window of the control. When you need to update the data, you only need to update your own copy of it and you'll only update those listview items that are shown on the UI, not the entire 20K set.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload