Serialcoder en Français Serialcoder in English
TEL : +33 (0)9 72 13 15 17

Windows Forms FAQ resources

4. Windows Forms Data Binding

4.22 I programatically 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?


You can call the EndCurrentEdit method on the bindingmanager for the TextBox.

[C#]
     this.textBox1.Text = "XXXX"; //set the value
     this.textBox1.DataBindings["Text"].BindingManagerBase.EndCurrentEdit(); //end the edit

[VB.NET]
     Me.TextBox1.Text = "XXXX"