Solved

Key Press backspace not working!

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now