如何在将新记录添加到BindingSource之前将其检查到BindingSource中?
我想创建一种方法来检查绑定源中“添加的”行中的值并更新一些值,然后更新数据源
答案 0 :(得分:0)
我想找到了解决方法
DataRowView dataRowView = (DataRowView)bindingSource.Current;
if (dataRowView.IsNew)
{
dataRowView[2] = NewValue; // change values
// but why here I cannot get the column by name like dataRowView["ID"] it returns DbNull
}
BindingSource.EndEdit();