Binding textboxes (again)

  • Thread starter Thread starter VB Learner
  • Start date Start date
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
 
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,
 
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
 
Back
Top