Hi Goh,
If you want to display the records of two tables which have a parent/child
relationship in a Windows form, you could use two DataGridView controls to
show the records of the two tables respectively.
The main steps of creating a master/detail form using two DataGridView
controls is listed below.
1. Create a DataSet which involves the two datatables(e.g tableParent and
tableChild) and add a DataRelation(e.g relation1) of the two datatables in
the DataSet
2. Add a instance of the DataSet (e.g dataset1) and two BindingSource
instances(e.g parentBindingSource and childBindingSource) into your form
3. Use the statements to set the DataSource and DataMember of the two
BindingSource instances:
parentBindingSource.DataSource = dataset1;
parentBindingSource.DataMember = "tableParent";
childBindingSource.DataSource = parenBindingSource;
childBindingSource.DataMember = "relation1";
For more information, you may refer to the following link:
http://msdn2.microsoft.com/en-us/library/y8c0cxey(d=ide).aspx
Hope this helps.
If you have anything unclear, please don't hesitate to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
====================================================
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
====================================================