Solved

Key Press backspace not working!

Posted on 2008-06-22
2
2,372 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
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 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