0
我有一个DataGridView,其中有一个DataGridViewComboCell的单元格。每个DataGridViewComboCell绑定到一个BindingList的唯一副本。当我从绑定列表中删除项目时,组合框将删除已从绑定列表中删除的条目。
但是,如果选择了该值,它将作为单元格中的选定项目。从BindingList中删除项目不会刷新DataGridViewComboBoxCell
我试着做一个datagridview.refresh(),但它仍然没有帮助。
1)你应该不需要刷新后打电话到EndEdit中:它正从工具条菜单项
// _contractLists is List<BindingList<String>> which is the datasource for a datagridviewcombobox
List<String> removedList = new List<string>();
_contractSelForm.ShowDialog();
_contractSelForm.GetandClearRemovedContracts(ref removedList);
foreach (BindingList<String> contractList in _contractLists)
{
// remove deleted favorites
foreach (string contract_name in removedList)
{
contractList.Remove(contract_name);
}
}
dataGridView1.Refresh();
dataGridView1.EndEdit();
你是否正在移动或更改正确事件中的绑定。你可以粘贴你正在使用的代码..?还datagridview.Bind()或绑定听起来像是要看的东西..只是猜测这里没有看到你的代码 – MethodMan 2012-01-03 22:33:58
你可以显示如何绑定BindingLists组合框列? dataGridView1是否处于虚拟模式? – Kimberly 2012-01-03 23:42:36