Hi bobness,
We can create a BindingSource and bind it to comboBox2 whose data source based on the selected value of comboBox1. This is a code snippet:
BindingSource bindSrc = new BindingSource();
bindSrc.DataSource = GetComboBox2DataSource();
comboBox2.DataSource = bindSrc;
Then we need to handle the SelectedValueChanged event to filter the data source of comboBox2. This is a code snippet:
const string FILTER_COL_NAME = "col1";
void comboBox1_SelectedValueChanged(object sender, EventArgs e)
{
BindingSource bindSrc = comboBox2.DataSource as BindingSource;
bindSrc.Filter = string.Format("{0} = '{1}'", FILTER_COL_NAME,comboBox1.SelectedValue);
}
This is a sample shows how to bind data to a ComboBox:
http://msdn.microsoft.com/en-us/library/x8ybe6s2(VS.80).aspx.
Let me know if this helps.
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.