Problem solved. I was missing the following line which allows the dataset
to see the changes:
this.BindingContext[dataset1.Tables[0]].EndCurrentEdit();
After calling this, dataset1.HasChanges correctly comes back as true.
One additional note though. Just making this call will NOT work:
this.BindingContext[dataset1].EndCurrentEdit();
Hope this helps someone else out there...
Andrew
On Wed, 12 Nov 2003 08:44:33 +0000, Andrew wrote:
> I'm seeing an interesting problem when binding a textbox to a dataset.
> The binding works correctly and will display the value, and when the value
> is changed in the textbox, the value in the dataset is also changed.
> HOWEVER, the dataset.HasChanges() call comes back with false! Am I not
> binding correctly? Here's the line i'm using to bind:
>
> textbox1.DataBindings.Add("Text",dataset1.Tables[0],"field1");
>
> I must be doing something right because the textbox get data, and when I
> change it, it is reflected in the dataset.
>
> One other note, if I add a datagrid to the form, and databind that to the
> same dataset, and then modify the grid, the dataset data changes as well,
> and the dataset.HasChanges() call correctly comes back as true.
>
> Am I not binding the textbox correctly? Is this a bug?
>
> TIA,
> Andrew
|