Martin Martin - 27 days ago 22
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

bsSending.EndEdit();


((DataRowView)this.bsSending.Current).Row)
now contains the new values, but the
RowState
is still unchanged. How can this be possible? I haven't any calls to
AcceptChanges()
before I make the value changes in the GUI

Answer

UPDATE:

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

Comments