I appreciate if anyone can advise if there is event handler or other ways to validate changes from a data binded textbox before updating data source. I have a windows form with a data repeater. In the data repeater, I have a textbox which is data binded as follows:
BindingSource bindingsource = new BindingSource();
DataSet ds = new DataSet("Preferences");
DataTable table = new DataTable("Preference");
for (int i = 1; i <= 12; i++)
bindingsource.DataSource = ds;
bindingsource.DataMember = "Preference";
textBox1.DataBindings.Add(new Binding("Text", bindingsource, "Value", true, DataSourceUpdateMode.OnValidation));
As can be seen in the code, I have set the textbox to DataSourceUpdateMode.OnValidation. When I ran the project and change the textbox value on the form, I can see that the dataset (ds) is updated correctly. However, I want to be able to validate my entry before committing the new value into my data source.
Is there a special way, using handler or interface to do this please?