Solved

Key Press backspace not working!

Posted on 2008-06-22
2
2,358 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
Comment Utility
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
Comment Utility
:\ woops....suppose I couldn't see it for looking at it. Thanks!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

10 Experts available now in Live!

Get 1:1 Help Now