Vb net row validating

Notice how the Column Index and Row Index properties of Data Grid View Cell Validating Event Args parameter are used.At run time, if the validation fails, the Data Grid View displays a red exclamation icon in that cell (see below).I can check to see that there is an issue, and throw the appropriate error message if there is.The problem is being unable to cancel the moving from row to row (and, as such, attempting to save the changes).

I have tried the below code on datagrid View Cellvalidation event but its not working.

Custom row validation is done using the Ending Edit and Validation Error events.

In the Ending Edit event, the custom validation is provided and in the Validation Error event, you can decided if you want to allow the row to exit edit mode in the case where the values of one or more of its cells do not pass the validation process (see Example 1).

Hovering the mouse pointer on the icon displays the Error Text that you set earlier.

The Data Grid View control of Windows Forms is a versatile control that can help you create professional-looking data entry forms.