Actually it's quite simple. One important thing is that all control bindings
must refer to tables and columns indirectly thru dataset. If you bind the
controls directly to particular tables/columns, you'll loose the synchro you
want while browsing tableParent.
You're supposed to name the tables (at least tableParent) and relations, if
they aren't named yet (use TableName and RelationName properties).
' let's say the DataSet object is ds
' for tableParent
parentGridView.DataSource = ds
parentGridView.DataMember = "tableParent_name"
' for tableChild1 each control must have separate binding, eg. binding to
sampleTextBox.Text looks like this:
sampeTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", ds,
"tableParent_name.parent_child2_relation_name.colu mn_name", True))
' for tableChild2
child2GridView.DataSource = ds
child2GridView.DataMember = "tableParent_name.parent_child2_relation_name"
' FOLLOWING IS THE WRONG WAY
child2GridView.DataSource = ds.Tables("tableParent_name")
child2GridView.DataMember = "parent_child2_relation_name"
Hope you find it simple ;)
Aph
Got a datagridview with records bound to tableParent. Each time I go to a
new row (single select) in the datagrid view I want a series of textboxes
as well as another datagridview to shwo the realted records. The textboxes
are in tableChild1 and the other datagridview is of tableChild2, Both
these tables have a PK-FK relationship established in the dataset being
used. How can I do this?
Any help appreciated.
Bob