Hello:

I have a form that has a dataset that has one table, a
command button, and a data-bound textbox. I also have
navigation button that navigates through my dataset.

When I run the application, I see the row values
displayed appropriately.

But when I make changes to the value that is dispalyed
textbox and click on the Update command button to save
the changes, the changes are lost when I refill the
dataset.

But if I navigate to the privious or next row and then
click on the Update button, my changes are saved.

Can somebody explain to me what's happening?

Here's the code


Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
tbxDDLID.DataBindings.Add(New Binding("Text",
MyDataSet.Tables("DDL"), "DDL_ID_N"))
tbxDDLName.DataBindings.Add(New Binding("Text",
MyDataSet.Tables("DDL"), "DDL_Name_C"))
End Sub

Private Sub btnUpdate_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnUpdate.Click
MyDataset.Update()
End Sub
.

Re: Problem using a textbox to change the data by Stephen

Stephen
Wed Jul 30 23:15:17 CDT 2003

Venkat,

You need to get the CurrencyManager and call its EndCurrentEdit method

eg.
Dim cm as CurrencyManager = Me.TextBox1.BindingContext(<your DataTable>)
cm.EndCurrentEdit

Stephen

"Venkat Venkataramanan" <the_rs@hotmail.com> wrote in message
news:06b101c356dd$a517d6f0$a101280a@phx.gbl...
> Hello:
>
> I have a form that has a dataset that has one table, a
> command button, and a data-bound textbox. I also have
> navigation button that navigates through my dataset.
>
> When I run the application, I see the row values
> displayed appropriately.
>
> But when I make changes to the value that is dispalyed
> textbox and click on the Update command button to save
> the changes, the changes are lost when I refill the
> dataset.
>
> But if I navigate to the privious or next row and then
> click on the Update button, my changes are saved.
>
> Can somebody explain to me what's happening?
>
> Here's the code
>
>
> Private Sub Form1_Load(ByVal sender As System.Object,
> ByVal e As System.EventArgs) Handles MyBase.Load
> tbxDDLID.DataBindings.Add(New Binding("Text",
> MyDataSet.Tables("DDL"), "DDL_ID_N"))
> tbxDDLName.DataBindings.Add(New Binding("Text",
> MyDataSet.Tables("DDL"), "DDL_Name_C"))
> End Sub
>
> Private Sub btnUpdate_Click(ByVal sender As
> System.Object, ByVal e As System.EventArgs) Handles
> btnUpdate.Click
> MyDataset.Update()
> End Sub
> .
>
>