Text Box Data Binding Not Always Updating

B

Barry Gast

Hi. I seem to be running into a problem with binding the text property of a
text box to a column in a data table. When the user updates the text in the
text box through the interface (form), the underlying data table is updated.
However, when, in code, the text property of the text box is assigned a new
value, the underlying data table is not updated. Is this by design or is
this a bug? Or am I missing something?

Code:

TextBox1.DataBindings.Add(New Binding("Text", MyClass.DataTable1,
"MESSAGE_TEXT")

' assigning this value does not update the DataTable1 data table.
TextBox1.Text = "New Message Text"

MyClass contains a data table member, DataTable1, that has a field
MESSAGE_TEXT.

Thanks.

-Barry Gast
 
H

Herfried K. Wagner [MVP]

* "Barry Gast said:
text box to a column in a data table. When the user updates the text in the
text box through the interface (form), the underlying data table is updated.
However, when, in code, the text property of the text box is assigned a new
value, the underlying data table is not updated. Is this by design or is
this a bug? Or am I missing something?

Code:

TextBox1.DataBindings.Add(New Binding("Text", MyClass.DataTable1,
"MESSAGE_TEXT")

' assigning this value does not update the DataTable1 data table.
TextBox1.Text = "New Message Text"

MyClass contains a data table member, DataTable1, that has a field
MESSAGE_TEXT.

If you don't get an answer here, feel free to post to this group:

<
 

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