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. While this code snippet may solve the question, including an explanation really helps to improve the quality of your post.Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.In this case, you need to add a Combo Box to the cells in the desired column.
Cancel = True End If End Sub Private Sub data Grid View1_Cell End Edit(By Val sender As Object, _ By Val e As System. Cell End Edit ' Clear the row error in case the user presses ESC. For more information, see Protecting Connection Information.
_ Data Grid View Editing Control Showing Event Args) _ Handles Data Grid View1.