The following code example handles the Cell Validating event to ensure that only positive integers are entered by the user. Error Text = "" Dim new Integer As Integer ' Don't try to validate the 'new row' until finished ' editing since there ' is not any point in validating its initial value.
I tried Cell Validating, but it could not pull the values in to validate. Private Sub dg Checks_Cell Validating(By Val sender As Object, By Val e As System. Cell Validating Dim Val Date As Date = Nothing Dim Val Long As Long = 0 If dg Checks. Data Grid View Cell Validating Event Args) Handles dg Checks. The significant piece of this sample is the staff code. It sets up a data connection and all the form controls entirely through code.