具有单个DataSource的多个ComboBox [英] Multiple ComboBox with single DataSource

查看:51
本文介绍了具有单个DataSource的多个ComboBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个组合框,它们绑定到数据集中的单个绑定源。当我在一个组合框中选择一个项目时,它们都会改变。我自己的组合框中没有代码,但确实有数据集填充:

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);

这可能是什么原因?

推荐答案

为每个ComboBox赋予自己的BindingSource:

Give each ComboBox their own BindingSource:

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

这篇关于具有单个DataSource的多个ComboBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆