DataGridView BindingSource Master Child conundrum

  • Thread starter Thread starter John Rivers
  • Start date Start date
J

John Rivers

this should be a simple bit of code:

// Build DataSet
dataset.Tables.Add(tblMaster);
dataset.Tables.Add(tblChild);
dataset.Relations.Add(tblMaster.Columns["DelSchedID"],
tblChild.Columns["DelSchedID"]);

// Build Master BindingSource
srcMaster.DataSource = dataset;
srcMaster.DataMember = "Master";

// Build Child BindingSource
srcChild.DataSource = dataset;
srcChild.DataMember = "Child";

// Bind Controls
gridMaster.DataSource = srcMaster;
gridChild.DataSource = srcChild;

it all works *except* the gridChild isn't filtered

any ideas?
 
Solution was easy
the child BindingSource.DataSource should be set to the master
bindingsource (not to the dataset)
and the child BindingSource.DataMember should be set to the name of
the DataRelation
 
Back
Top