Update DataSource of DataGridView from another thread

If newDataSource comes from another thread, assignment will lead to a runtime exception. To avoid that, using Invoke…

// in UI thread
public void SetBindingSourceDataSource(object newDataSource)
{
  if (this.dataGridStatus.InvokeRequired)
  {
     Invoke(new Action<object>(SetBindingSourceDataSource), 
            newDataSource);
  }
  else
  {
    this.statusItemBindingSource.DataSource = newDataSource;
  }
}