title: Selecting all items in a ListBox Winform Control
body: <p>I'm trying to select all items in ListBox and made this extension method for this purpose:</p>
  
  <pre><code>    public static void SetSelectedAllItems(this ListBox ctl)
      {
          for (int i = 0; i &lt; ctl.Items.Count; i++)
          {
              ctl.SetSelected(i, true);
          }
      }
  </code></pre>
  
  <p>Problem is that if I have lots of items in the ListBox, it takes a long time to accomplish this task and I can watch how the ListBox is automatically scrolling down and selecting items.</p>
  
  <p>Is there a way to temporary pause the update of a control, so that the task would finish faster? I tried using:</p>
  
  <pre><code>ctl.SuspendLayout();
    for (int i = 0; i &lt; ctl.Items.Count; i++)
    ...
  ctl.ResumeLayout();
  </code></pre>
  
  <p>But that doesn't seem to do anything.</p>