How can I update the value of a textbox to the anchor source using C #?
3 answers
The DataBinding usually does not write a value until the control loses focus. Since you are updating the TextBox programmatically, the DataBinding does not know that something needs to be updated.
As you wrote your code, you will need to call the method WriteValue()
yourself (assuming there is only 1 data binding in the TextBox):
txtLastModifyUserID.DataBindings.Add("Text", c_bsDataSetSource, "LastModifyUserID");
txtLastModifyUserID.Text = "1234";
txtLastModifyUserID.DataBindings[0].WriteValue();
+11
source to share