Martin Martin - 11 months ago 140
C# Question

EndEdit on BindingSource updates DataTable, but rowstate still unchanged

I have a bindingsource which has a datasource which is a datatable.

All the winforms controls has added databindings to the bindingsource

I do a value change in the GUI (writes to the controls' .text property)

then on Save i do following


now contains the new values, but the
is still unchanged. How can this be possible? I haven't any calls to
before I make the value changes in the GUI

Answer Source


Don't know why, but it seems that calling the specific row's EndEdit does the trick. The row's parent is a datatable and the table's dataset is the datasource of the bsSending Datasource. Calling bsSending.EndEdit() only updates the values but doesn't update the rowstate.

I have surfed the .net for similiar problems and they indicate that when calling AcceptChanges() on the dataset BEFORE binding data, then you may get this error (values updated to dataset but rowstate remains unchanged). I haven't seen any solutions to the problem, though, so I keep my workaround solution