Groups | Blog | Home
all groups > dotnet windows forms databinding > march 2005 >

dotnet windows forms databinding : Textbox bound to Dataset row, After editing HasChanges return fals


N.Sheffer
3/30/2005 7:25:02 AM
I created a form that is displayed as DialogBox for the user. The form has
couple of Textbox that are bound to the Dataset and shows the current value
in them correctly.
"
TextBox1.DataBindings.Add("Text", DS, "TableName1.FieldName1");
TextBox2.DataBindings.Add("Text", DS, "TableName1.FieldName2");
"
The problem I want to Reject the changes done durring edit if the user press
the "Cancel" button and the verify that he would like to save the changes on
"OK".

I called the HasChanges() but even when changes been done I still get false.
I also looked in the Dataset its self and the row in question doesn't have
any Version beside "current".

I called DS.AccecptChanges before activating the form and also added
BeginEdit on the proper table on the Form load with no results.

Thanks
David Lei
4/5/2005 5:42:41 PM
Try calling the EndEdit() on the row after edit it.

david


[quoted text, click to view]

N.Sheffer
4/5/2005 11:17:02 PM
Thanks but i tried that already,
I also added BeginEdit on the form load() and EndEdit before the OK with no
help.

At the end the solution i found was insted of writing
TextBox1.DataBindings.Add("Text", DS, "TableName1.FieldName1");
I changed it to
TextBox1.DataBindings.Add("Text", DS, "TableName1[0].FieldName1");

And this seem to work so far

Thanks
Noam

[quoted text, click to view]
AddThis Social Bookmark Button