Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

How do I ensure that programmatic changes to the value of a bound control get updated in the DataSource?

I programmatically change a bound TextBox value, but the value does not get pushed back into the bound DataSource. How can I make sure the DataSource is updated?

Call the EndCurrentEdit method on the BindingManager for the control. Here is an example.

textBox1.Text = "New value"; //set the value

//end the edit
textBox1.DataBindings[ "Text" ].BindingManagerBase.EndCurrentEdit();

Contributed from George Shepherd's Windows Forms FAQ