When using a bindingNavigator and bindingSource and clicking a move button or add button or delete button, the bindingSource completes its action code before the click handler of the button (i.e. user code)
This prevents a save action on the row change. I'd like to find a bindingSource hook, something like 'befo开发者_如何学PythonreRowChange'.
I can subclass the bindingSource and get ahead of the add or remove event but that doesn't cover all the row move actions.
Any clues, suggestions welcome.
The BindingNavigator has a property called 'DeleteItem'. Change this property from 'BindingNavigatorDeleteItem' to '(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();
}
}
}
精彩评论