2015-10-13 29 views
3

我有2個組合框綁定到數據集中的單個綁定源。當我在其中一個組合框中選擇一個項目時,它們都會改變。我沒有在組合框代碼本身,而是我有數據集填充:帶單個數據源的多個組合框

this.cLIENT_BranchesTableAdapter.Fill(this.gcDataSet.CLIENT_Branches); 

可能是什麼造成的?

回答

3

給每個組合框自己的BindingSource:

comboBox1.DataSource = new BindingSource(source, string.Empty); 
comboBox2.DataSource = new BindingSource(source, string.Empty); 
+0

感謝拉爾斯。這工作。 –

+0

等等,顯示成員和值成員怎麼樣?將在參數中? –

+0

@JoshuaMasangcay這些屬性可以保持不變。數據仍然指向相同的數據表。 BindingSource不需要這些參數。 – LarsTech

1

這應該可以解決您的問題。

combobox2.BindingContext = new BindingContext(); 
相關問題