Link to home
Start Free TrialLog in
Avatar of garethh86
garethh86Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Key Press backspace not working!

Hi there

Please see code below, trying to although the user to enter numbers but not characters which works perfectly, the backspace key doesn't work though! DEL works, have even added in the ascii code for backspace (8) and allowed it to handle key press, doesn't work at build though!

ANy ideas where it's going wrong?

Thanks!
If e.KeyChar >= Chr(48) And e.KeyChar <= Chr(57) Then
            e.Handled = False ' works!
'added this line to see if it work, but doesn't!
        ElseIf e.KeyChar = Chr(8) Then ' 8 is Backspace
            e.Handled = True
        Else
            e.Handled = True
        End If

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of garethh86

ASKER

:\ woops....suppose I couldn't see it for looking at it. Thanks!