about keypress in keyascii

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2008
Posts: 161
Reputation: ryan311 has a little shameless behaviour in the past 
Solved Threads: 1
ryan311 ryan311 is offline Offline
Junior Poster

about keypress in keyascii

 
0
  #1
Dec 4th, 2008
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!
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 8
Reputation: Zermoth is an unknown quantity at this point 
Solved Threads: 0
Zermoth's Avatar
Zermoth Zermoth is offline Offline
Newbie Poster

Re: about keypress in keyascii

 
0
  #2
Dec 5th, 2008
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/
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: about keypress in keyascii

 
0
  #3
Dec 10th, 2008
Hi,

Change your code to :

  1. If KeyAscii <> 8 Then
  2. if keyascii >= 48 and keyascii <= 75 then
  3. exit sub
  4. else
  5. keyascii = 0
  6. end if
  7. End If

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 161
Reputation: ryan311 has a little shameless behaviour in the past 
Solved Threads: 1
ryan311 ryan311 is offline Offline
Junior Poster

Re: about keypress in keyascii

 
0
  #4
Dec 10th, 2008
thnx
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC