Multiple ComboBox with single DataSource

末鹿安然 提交于 2020-02-14 17:18:11

问题


I have 2 combo boxes that are tied up to a single binding source in a dataset. When I select an item in one of the combo boxes, they both change. I don't have code in the combobox themselves but I do have the dataset fill:

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

What could be causing this?


回答1:


Give each ComboBox their own BindingSource:

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



回答2:


This should fix your issue.

combobox2.BindingContext = new BindingContext();


来源:https://stackoverflow.com/questions/33108993/multiple-combobox-with-single-datasource

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!