【发布时间】:2010-10-27 15:02:56
【问题描述】:
这似乎是一项简单的任务,但可能有更简单的方法。
我有一个包含 30 个组合框的表单,它们都需要相同的数据集。目前我绑定每一个:
DataTable t = GetData();
this.ComboBox1.DataSource = t;
this.ComboBox1.DisplayMember = "heading";
this.ComboBox2.DataSource = t;
this.ComboBox2.DisplayMember = "heading";
this.ComboBox3.DataSource = t;
this.ComboBox3.DisplayMember = "heading";
...
...
this.ComboBoxN.DataSource = t;
this.ComboBoxN.DisplayMember = "heading";
有没有办法以一种不那么乏味的方式将它们全部绑定在一起?
谢谢。
【问题讨论】:
标签: c# winforms data-binding combobox