The controls in my form are bounded to a datasource, including textboxes,
comboboxes, etc...
Something lame happens: In runtime, the last focused control before clicking
on my save button, doesn't have its datasource bounded value refreshed with
the new data inputed. I think the control's LostFocus event it's not properly
fired when I click a ToolStrip button, and the databinding is not updated.
I came with the following piece of code on the Save function to solve this
problem:
if (this.ActiveControl != null && (this.ActiveControl is TextBox ||
this.ActiveControl is ComboBox || this.ActiveControl is MaskedTextBox))
this.ActiveControl.DataBindings[0].WriteValue();
It works fine. I just wonder if there's a better and cleaner way to solve my
problem; a property or something.
Thanks and happy chrtistmas.