Binding multiple DataGridViews to one BindingSource

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a DataSet containing some data and a BindingSource object that is
bound to a particular table in the DataSet. Then I have two DataGridViews on
different tab pages that should both display the data from the DataSet, via
the BindingSource. I set the DataSource and DataMember properties of the
BindingSource to correspond to the table in the DataSet, and I set the
DataSource property of both the DataGridViews to be the BindingSource. Then,
at some later point in time, the DataSet is populated with data by another
thread and when that's complete I call Refresh on all the DataGridViews.

The problem I'm having is that only the first grid that was bound is
updating to show the rows that get added. I've tried checking the number of
rows in the BindingSource just before the second grid refreshes, and it's
correct, but the rows just aren't appearing there.

Any ideas?
 
Instead of calling Refresh on the DataGridViews after the off-thread
update, try calling bindingSource1.ResetBindings(true);.

======================
Clay Burch
Syncfusion, Inc.
 
Back
Top