Solved

Key Press backspace not working!

Posted on 2008-06-22
2
2,379 Views
Last Modified: 2013-11-26
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

0
Comment
Question by:garethh86
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
ID: 21841624
I guess it should be:
        If e.KeyChar >= Chr(48) And e.KeyChar <= Chr(57) Then
            e.Handled = False ' works!
        ElseIf e.KeyChar = Chr(8) Then ' 8 is Backspace
            e.Handled = False      <----------------------- this was true
        Else
            e.Handled = True
        End If
0
 
LVL 7

Author Comment

by:garethh86
ID: 21841767
:\ woops....suppose I couldn't see it for looking at it. Thanks!
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question