我正在尝试通过执行此操作从绑定到 DataGridView 的 BindingList 中删除对象...
private void RemoveItems(List<Payment> removeList)
{
for (int i = removeList.Count - 1; i >= 0; i--)
{
sortableBindingPaymentList.Remove(removeList[i]);
}
}
尝试自己调试时,我尝试了以下操作,但是 remover always = -1 (意味着找不到匹配项)并且我 110% 确定我在 removeList 中的付款列表在我的 sortableBindingList 中包含匹配项...
private void RemoveItems(List<Payment> removeList)
{
int remover;
for (int i = removeList.Count - 1; i >= 0; i--)
{
remover = sortableBindingPaymentList.IndexOf(removerList[i]);
sortableBindingPaymentList.RemoveAt(remover);
}
}
任何帮助表示赞赏,并提前感谢!