First combo box
lstSelectItem.DataSource = null;
lstSelectItem.DataSource = dtSelect;
lstSelectItem.DisplayMember = "Name";
lstSelectItem.ValueMember = "ID";
In selectedIndexchange of the above.. u could write the below
private void lstSelectItem_SelectedValueChanged(object sender, EventArgs
e)
{
lstLinked.DataSource = null;
DataRowView dtView = ((DataRowView)lstSelectItem.SelectedItem);
int intLocalUnqiueID = int.Parse(dtView["ID"].ToString());
dvLinked.RowFilter = "ID = " + intLocalUnqiueID;
lstLinked.DataSource = dvLinkedRows;
lstLinked.DisplayMember = "Name";
lstLinked.ValueMember = "ID";
}
HTH
VJ
"juventusaurabh" <sa************@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Hi,
I have a couple of combo boxes and the data inthe combo boxes is
from the SQL database. I have created datasets to reflect that data in
one of the combo box.
But, what I want is that, when I select certain data from one combo
box, the data in other comboBox should automatically reflect the
related data from the first combo box.
For example, If I select a state IL from comboBox1 (from dataset from
sql database "state" column), then the values in comboBox2 should
automatically reflect only cities from IL (from the sql database table
"city" column).
Can anyone assist?? I would appreciate if anyone can even give me
references for related examples.
Thanks,