Hola foros gracias a mi amigo Aquaventus pude solucionar mi problema allí les dejo el código este lo llamo desde el EditingControlShowing
Código vb:
Ver originalPrivate Sub Validar_Keypress8(ByVal sender As Object, ByVal e As KeyPressEventArgs)
Try
Dim columna As Integer = dgvDocumento.CurrentCell.ColumnIndex
If columna = 2 Then
If ColumnTipoCompr.Equals("01") Then
'Si la longitud es 8
If DirectCast(sender, TextBox).Text.Length = 8 Then
'Habilitamos el borrar
If Char.IsControl(e.KeyChar) Then
'Permitimos borrar
e.Handled = False
Else
'Evitamos que se ingresen más
e.Handled = True
End If
Else
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End If
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "TÍTULO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Try
End Sub