【发布时间】:2010-12-01 08:00:17
【问题描述】:
我在 access 数据库文件中有一个表。我想在 DataGridView 中显示该表,我有一个绑定到该表的绑定源。然后 DataGridView 绑定到 bindingsource。我还有其他控件(文本框、组合框)通过相同的绑定源绑定到表的“dataMember”。一切正常。但是当我将组合框的“DropDownStyle”从“DropDown”更改为“DropDownList”时。绑定坏了。当我在 datagridview 中选择不同的行时,组合框中的数据不会更改。但是,当我更改组合框中的数据时,DataGridView 中单元格中的数据发生了变化。有人有想法吗?非常感谢!
The following is my code:
combobox1.Items.AddRange( new Object[]{
"Monday",
"Tuesday",
.....
.....
"Sunday"
});
bindingsource1.DataSource = dt; // dt is a instance of DataTable
combobox1.DataBindings.Add("Text", bindingsource1,"Day");
【问题讨论】:
-
我认为您所描述的行为是“设计使然”。
标签: winforms