The Data Grid View control of Windows Forms is a versatile control that can help you create professional-looking data entry forms.
To determine the state of the current cell, use the Data Grid View Cell Validating Event Args. When this event is canceled in data-bound mode, the new value is not pushed to the underlying data source.
Row Index and Data Grid View Cell Validating Event Args. When this event is canceled in virtual mode, the Data Grid View.
If the cell value fails validation, set the Cancel property of the System. This causes the Data Grid View control to prevent the cursor from leaving the cell.
Set the Error Text property on the row to an explanatory string.
This displays an error icon with a Tool Tip that contains the error text.