1) Append
.DefaultView
to these lines:
Product1.DataSource = ds1.Tables[0].DefaultView;
Product2.DataSource = ds2.Tables[0].DefaultView;
2) Double-Click the Product1-ComboBox in the Form-Designer. It will add this to your Form-Class:
private void Product1_SelectedIndexChanged(object sender, EventArgs e)
{
}
3) Add these two lines:
private void Product1_SelectedIndexChanged(object sender, EventArgs e)
{
if (Product1.ValueMember == "ID")
((DataView)Product2.DataSource).RowFilter = "ParentID = " + Product1.SelectedValue;
}
4) Double-Click into a free space on your Form in the Form-Designer. It will add this to your Form-Class:
private void Form1_Load(object sender, EventArgs e)
{
}
(It might be something different than "Form1" for you.)
5) Add this line:
private void Form1_Load(object sender, EventArgs e)
{
Product1_SelectedIndexChanged(null, null);
}
That should be it.