title: How to use multithreading with Winform?
body: <p>I'm a newbie with multithreading. I have a winform that have a label and a progress bar.</p>
  
  <p>I wanna show the processing result. Firstly, I use <code>Application.DoEvents()</code> method. But, I find that the form is freezing. </p>
  
  <p>Then I read some article about multithreading at MSDN.</p>
  
  <p>Secondly, I use a BackgroundWorker to do it. </p>
  
  <pre><code>this.bwForm.DoWork += (o, arg) =&gt; { DoConvert(); };
  this.bwForm.RunWorkerAsync();
  </code></pre>
  
  <p>The form doesn't freeze that I can drag/drog when processing. Unfortunately, it throws an InvalidOperationException. So I have to use this. <code>Control.CheckForIllegalCrossThreadCalls = false;</code> I ensure that's  not a final solution. </p>
  
  <p>Do you have some suggestion to do so, Experts?</p>
  
  <p><strong>Edit:</strong>
  When I call listview throw InvalidOperationException. This code is in DoWork().</p>
  
  <pre><code>          foreach (ListViewItem item in this.listView1.Items)
              {
                  //........some operation
                   lbFilesCount.Text = string.Format("{0} files", listView1.Items.Count);
                   progressBar1.Value++;
              }
  </code></pre>
  
  <p><strong>Edit2:</strong>
  I use delegate and invoke in DoWork() and it don't throw exeption. But the form is freezing again. How to do it so the form could be droppable/drappable while processing?</p>