Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Key Press backspace not working!

Posted on 2008-06-22
2
Medium Priority
?
2,400 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 2000 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

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

972 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