Call validating event c
To display the dataset column error, invoke the Set Column Error method of the Error Provider.
I display the data of the is datagridview in another interface and make the cells read-only. But the thing is when I click on a row that data was added previously and press the Add new row the cell validating event is triggered.Non-validating actions are used when the user quits an application, for example, because otherwise the user remains in the application if the entries are invalid.In addition, you can use it to reset the entries in all fields of a view at runtime.You can also display a custom error image instead of the default image.
Now we will add code in our sample to validate the complete form when the "Create Appointment" button is clicked.
In this example, we will see how to use the Error Provider control in Windows forms to provide validations in Windows Forms and display user-friendly error messages to the user if the validation fails. Add controls as shown in the figure below and set the properties of the controls as indicated in the table.