Databindings lost on change?

  • Thread starter Thread starter Bill Foust
  • Start date Start date
B

Bill Foust

I'm seeing a situation where a textBox value looses its
databinding if the value of the textBox is manually
changed. Is this supposed to happen or a bug?

To recreate:

create a simple dataset

Create a new form and add dataset and textBox and button

bind the textBoxt.Text property to a column in the dataset

NOTE: The dataset is not used in conjunction with any
other database objects

In the constructor of the form, add code to add a row to
the dataset.

In the button, change the value of the cell in the dataset


Run app and press button. notice the value appropriately
is displayed automatically in the testbox on the form.

change the value of the textbox directly
now notice pressing the button does not update the textbox
any longer.

Thanks
Bill
 
Hi Bill,

I'd like to say it's not a bug.
We know the Texbox has "edit" mode when using databinding.
Textbox will enter the "edit" mode when you change the text in it, it will
not end the edit mode
until you move off the current row or call the "EditEdit" /
"EndCurrentEdit" method explicitely.
In "Edit" mode , the test value will not sync with the underlying data
source, because we don't want to see the data changes automatically when we
are editing the current row.

That's the value is not updated when you changed the text. The textbox
is still bounded.
If you have only one text box , you may try add the EndCurrentEdit method
in focus leave event handler.

Does it answer your problem?
If you have anything unclear , please be free to reply this thread to let
me know.
Thanks!




Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending.
 
Back
Top