Private Sub DataGridView1_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing
AddHandler CType(e.Control, TextBox).KeyPress, AddressOf TextBox_keyPress
End Sub
Private Sub TextBox_keyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
If Char.IsDigit(CChar(CStr(e.KeyChar))) = False Then e.Handled = True
If Not (Char.IsDigit(CChar(CStr(e.KeyChar))) Or e.KeyChar = ".") Then e.Handled = True
If e.KeyChar = Convert.ToChar(Keys.Back) Then e.Handled = False ' Check back space key
End Sub
AddHandler CType(e.Control, TextBox).KeyPress, AddressOf TextBox_keyPress
End Sub
Private Sub TextBox_keyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
If Char.IsDigit(CChar(CStr(e.KeyChar))) = False Then e.Handled = True
If Not (Char.IsDigit(CChar(CStr(e.KeyChar))) Or e.KeyChar = ".") Then e.Handled = True
If e.KeyChar = Convert.ToChar(Keys.Back) Then e.Handled = False ' Check back space key
End Sub