Drstein99
Junior Contributor
PLEASE POST REPLIES IN VB.NET SYNTAX ONLY
I'm using keypress event, to trigger validation:
Public Sub esKeyPressInteger(ByVal sender As Object, ByVal e As KeyPressEventArgs)
and the VALUE of keys.delete (46) IS the same ASCII value of the ascii code for "." (decimal point)
How do i figure out that the char entered is only numeric, and also allow a delete or arrow key? I'm using this and it's malfunctioning:
If (Char.IsNumber(e.KeyChar) Or Asc(e.KeyChar) = Keys.Delete Or Asc(e.KeyChar) = Keys.Back) AND ASC(E.KeyChar) <> KEYS.Decimal Then
e.Handled = False
Else
e.Handled = True
End If
I'm using keypress event, to trigger validation:
Public Sub esKeyPressInteger(ByVal sender As Object, ByVal e As KeyPressEventArgs)
and the VALUE of keys.delete (46) IS the same ASCII value of the ascii code for "." (decimal point)
How do i figure out that the char entered is only numeric, and also allow a delete or arrow key? I'm using this and it's malfunctioning:
If (Char.IsNumber(e.KeyChar) Or Asc(e.KeyChar) = Keys.Delete Or Asc(e.KeyChar) = Keys.Back) AND ASC(E.KeyChar) <> KEYS.Decimal Then
e.Handled = False
Else
e.Handled = True
End If