Hi Mike,
Thank you for posting.
You could use BindingSource and DataRelation between the DataTables in a
DataSet to build a master/detail application.
Here is a sample for you.
Suppose there're a DataSet (e.g DataSet1) containing two DataTables(e.g
State and City). I create a data relation called State_City between the
StateID column in State and the StateID column in City.
I drag&drop a ListBox, a ComboBox and a DataGridView onto a form. I'd like
to display the data of the State table in the ListBox and ComboBox , and
the corresponding data of the City table in the DataGridView.
Below is the code snippet.
private void Form1_Load(object sender, EventArgs e)
{
BindingSource bindingSource1 = new BindingSource();
BindingSource bindingSource2 = new BindingSource();
bindingSource1.DataMember = "State";
bindingSource1.DataSource = this.dataSet11;
bindingSource2.DataMember = "State_City";
bindingSource2.DataSource = bindingSource1;
this.listBox1.DataSource = bindingSource1;
this.listBox1.DisplayMember = "StateName";
this.comboBox1.DataSource = bindingSource1;
this.comboBox1.DisplayMember = "StateName";
this.dataGridView2.DataSource = bindingSource2;
}
Hope this helps.
If you have anything unclear, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
============================================================================
=============================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.
============================================================================
=============================================
This posting is provided "AS IS" with no warranties, and confers no rights.