WinForms. How to make DataGridView to write cell value when use BindingNavigator

185 Views Asked by At

I have WinForms DataGridView and BindingNavigator on the From bind to the same BindingSource.

When user enter text into a cell of DataGridView (cell text editor is visible) and press "Move next" in BindingNavigator, it is assumed that the grid close cell text editor, text should be written in the DataTable Field and record end edit.

But the grid simply ignore the entered text, and returns the old value in to the cell.

Is it possible make grid to write the entered value when navigating through BindingNavigator?

1

There are 1 best solutions below

0
Ivan Stoev On BEST ANSWER

It's possible. All you need is to set the CausesValidation property of the BindingNavigator class to true.

Note that this property is false by default and also is hidden by the BindingNavigator base class ToolStrip, so you cannot do that at design time (also the documentation of the property is misleading). But you can do that via code (for instance, inside your form Load event):

this.bindingNavigator.CausesValidation = true;