How can I update the textbox value to the bindingsource using C#?
bindingsource, c#, textbox, winforms
Solution
The DataBinding doesn't usually write the value until after the control starts to lose focus. Since you are updating the TextBox programmatically, the DataBinding doesn't know there is something to update.
The way you wrote your code, you would have to call the `WriteValue()` method yourself (assuming only 1 databinding exists on the TextBox):
txtLastModifyUserID.DataBindings.Add("Text", c_bsDataSetSource, "LastModifyUserID");
txtLastModifyUserID.Text = "1234";
txtLastModifyUserID.DataBindings[0].WriteValue();
Problem
Consider this code: ``` txtLastModifyUserID.DataBindings.Add("Text", c_bsDataSetSource, "LastModifyUserID"); txtLastModifyUserID.Text = "1234"; ``` Why cannot the source be updated?