Tra keydown e keypress risolvi (con vb6 bastava keypress)
Cercando su google ho trovato il metodo più funzionale, almeno così mi pare
codice:
Private nonNumberEntered As Boolean = False
Private Sub TxtNumDoc_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TxtNumDoc.KeyDown, TxtNumDocP.KeyDown, TxtNumDocA.KeyDown
nonNumberEntered = False
' Determine whether the keystroke is a number from the top of the keyboard.
If e.KeyCode < Keys.D0 OrElse e.KeyCode > Keys.D9 Then
' Determine whether the keystroke is a number from the keypad.
If e.KeyCode < Keys.NumPad0 OrElse e.KeyCode > Keys.NumPad9 Then
' Determine whether the keystroke is a backspace.
If e.KeyCode <> Keys.Back Then
' A non-numerical keystroke was pressed.
' Set the flag to true and evaluate in KeyPress event.
nonNumberEntered = True
End If
End If
End If
'If shift key was pressed, it's not a number.
If Control.ModifierKeys = Keys.Shift Then
nonNumberEntered = True
End If
End Sub
Private Sub TxtNumDoc_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtNumDoc.KeyPress, TxtNumDocP.KeyPress, TxtNumDocA.KeyPress
If nonNumberEntered Then
' Stop the character from being entered into the control since it is non-numerical.
e.Handled = True
End If
End Sub
Tradotto: nel keydown controlli se è stato premuto un numero
Nel keypress annulli l'evento se non è un numero
Fatto su un campo di testo chiamato TxtNumDoc (a me serviva così) riportalo sulla datagrd nel caso in cui la cella è quella che ti interessa.