title: BackgroundWroker cross-thread operation not valid
body: <p>I created a backgroundworker to fill a datagirdview. The DatagridView is filled using a list which gets 2000 records from the table. I used background worker to remove the non-responsive UI.</p>
  
  <pre><code>private BackgroundWorker worker;
  worker = new BackgroundWorker() { WorkerReportsProgress = true };
  worker.DoWork += worker_DoWork;
  worker.RunWorkerAsync();
  
  void worker_DoWork(object sender, DoWorkEventArgs e)
  {
      var listAccGroups = vwAccVoucherDetails.ToList(); // vwAccVoucherDetails is the table containing records.
      dgvBalanceSheet.DataSource = listAccGroups;
  }
  </code></pre>
  
  <p>The error I am getting is:</p>
  
  <blockquote>
    <p>Cross-thread operation not valid: Control 'dgvBalanceSheet' accessed
    from a thread other than the thread it was created on.</p>
  </blockquote>
  
  <p>How can I set the datagridView's datasource without getting these kind of errors?</p>