Toolbars and menus do not force validation for controls in the DataGridView control.
Validation is a required part of validating and updating the data in a bound control. After the all controls on a form (together with the form itself) are validated, the changes can be commited. At the end, the table adapter needs to send the changes back to the database.
To achieve this, use the next lines of code in a click event handler on the form:
this.Validate();
this.customersBindingSource.EndEdit();
this.customersTableAdapter.Update(this.northwindDataSet.Customers);
- Advertisement -
- Advertisement -