0

i have 1 textbox

in the keypress event this is my code


if keyascii >= 48 and keyascii <= 75 then
exit sub
else
keyascii = 0
end if


how can i erase the last value that im inputted in my textbox using vbkeyback?

god bless daniweb!

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by ryan311
0

Not completely sure what you exactly want.
Here is my code to disable some user input and enable other

Instead of keypress use keydown

Select Case KeyCode
Case 0 to 7
KeyCode = 0
Case Is = 8
KeyCode = KeyCode
Case 9 to 31
KeyCode = 0
Case 32 to 127
KeyCode = KeyCode
Case 128 to 255
KeyCode = 0
End Select

--or--

Better off putting it in a module so you can call it any time

-- start module--
Function DisEsc(KeyCode As Integer) As Integer

Select Case KeyCode
Case 0 to 7
DisEsc = 0
Case Is = 8
DisEsc = KeyCode
Case 9 to 31
DisEsc = 0
Case 32 to 127
DisEsc = KeyCode
Case 128 to 255
DisEsc = 0
End Select
--end module--

--Form Code--

Private Sub Form_KeyDown(KeyCode As Integer)

KeyCode = DisEsc(KeyCode)

End Sub


get your ascii values at http://www.asciitable.com/

0

Hi,

Change your code to :

If KeyAscii <> 8 Then
    if keyascii >= 48 and keyascii <= 75 then
       exit sub
    else
       keyascii = 0
    end if
End If

Regards
Veena

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.