Hi,
On a window form, I've binded a textbox on a dataset. When I change the text of this textbox the dataset doesn't change.(I've tested with the HasChanged() method). Why
On the same form, if I bind a datagrid and I make changes in this datagrid, the HasChanged() method return true.
Can someone explain
(sorry for my english).

DataBinded TextBox
RakeshMishra
gbulfon
Note: I assume you are bound through a BindingSource.
1) You can add a "Commit" button that calls BindingSource.EndEdit();
2) You can add a "Validated" event to the TextBox and call BindingSource.EndEdit() in the Validated handler. You'd have to do this for each TextBox.
3) You can hook the BindingComplete event on the BindingSource and call BindingSource.EndEdit(). This will work for any TextBox (or other simple control) bound through the BindingSource. The code for this will look something like this:
private bool _endingEdit = false; private void customersBindingSource_BindingComplete(object sender, BindingCompleteEventArgs e)
{
if (!_endingEdit && (e.BindingCompleteState == BindingCompleteState.Success) && (e.BindingCompleteContext == BindingCompleteContext.DataSourceUpdate)){
try{
_endingEdit =
true; this.customersBindingSource.EndEdit();}
finally{
_endingEdit =
false;}
}
}
Joe
Derrick Morin
Hi, have the same problem, but the shown solution didn't work.
I wanted to update my datatable using the bindingsource.endedit() method. Instead of updating the datatable the method saves the changes in the bindingsource. The dataset.haschanges() method returns "false". How can I update the datatable