Binding textboxes (again)

V

VB Learner

I have a simple experimental form with a few textboxes and a couple of
buttons which move the BindingContext(..).Position up and down, and
another button to Update the database.
I can click through the records fine using the up/down buttons, but
when I type a new value into one of the textboxes, then click Update, it
doesn't get saved.
However, it DOES get saved if I click Up or Down away from that record
before clicking update.
Should I put something in the text_changed handler of the textboxes?
What?

Thanks,
VBL
 
V

VB Learner

Hmmm... on re-reading the above question, it seems some more info might
be helpful to any kind person trying to answer it:

I'm using VB .NET with MSDE, a Connection, an SqlDataAdaptor, and a
DataSet. The TextBoxes have databindings to the table. The text in
the modified TextBox goes into the DataSet ok, because clicking away
from, and then back to, that record shows the modified text, but it
doesn't get saved with Update UNLESS I click away from the record first.
Just typing in the new value then doing the Update doesn't work.

Thanks again,
 
G

Guest

You need to call the CurrencyManagers EndCurrentEdit Method before you call
your Update method. This will move the textbox value into the underlying
record.

To obtain the CurrencyManager:

dim oCM as CurrencyManager

oCM = CType(Me.BindingContenxt(YourDataSource, YourDataMember),
CurrencyManager)

then call oCM.EndCurrentEdit
 

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