Datagridview cell validating
Cell Validating Dim header Text As String = _ data Grid View1. Text = "Data Grid View validation demo (disallows empty Company Name)" End Sub Private Sub Form1_Load(By Val sender As System. All Cells Except Header) End Sub Private Sub data Grid View1_Cell Validating(By Val sender As Object, _ By Val e As Data Grid View Cell Validating Event Args) _ Handles data Grid View1. Header Text ' Abort validation if cell is not in the Company Name column. Equals("Company Name") Then Return ' Confirm that the cell is not empty.
You can also build this example in Visual Studio by pasting the code into a new project.
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.