使用bindingNavigator,bindingSource保存行更改的代码

当使用bindingNavigator和bindingSource并单击移动button或添加button或删除button时,bindingSource在button的点击处理程序(即用户代码)之前完成其操作代码,

这可以防止行更改上的保存操作。 我想find一个bindingSource钩子,像'beforeRowChange'。

我可以inheritancebindingSource并获得添加或删除事件的提前,但不包括所有的行移动操作。

任何线索,build议欢迎。

BindingNavigator有一个名为“DeleteItem”的属性。 将此属性从“BindingNavigatorDeleteItem”更改为“(none)”。

private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if ( bindingSource.Count > 0 ) { if (MessageBox.Show("Confirm Delete?", "Warning", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { bindingSource.RemoveCurrent(); } } }