I have the following in an app (WinForms, C#) using a BackgroundWorker and a DataGridView.
Works fine for small datasets, but blows up when there are a boatload of rows. Binding source error, DataMember and DataSource can't be the same, blah blah blah. Which they're not. It's a threading issue.
private void bkTrashCollection_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
BadFiles = 0;
private void CollectTrash()
foreach (DataGridViewRow Row in tbl_MediaDataGridView.Rows)
string FilePath = Row.Cells.Value.ToString();
Row.DefaultCellStyle.BackColor = Color.Yellow;
BadFiles += 1;
Where do I put the Lock or Invoke or whatever so it will work? None of the examples I've found work, except to make the changing of the BackColor not happen at all, rather than at least working half the time. :sigh:
I think a workaround would be to use that "MissingFiles" list to do the color changes when it comes out of the background thread, but I'd rather do it all in one swell foop, if possible.
Is it possible?