Problem using a textbox to change the data

  • Thread starter Venkat Venkataramanan
  • Start date
V

Venkat Venkataramanan

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
..
 
S

Stephen Muecke

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top