943,521 Members | Top Members by Rank

Ad:
Dec 4th, 2008
0

about keypress in keyascii

Expand Post »
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!
Similar Threads
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008
Dec 5th, 2008
0

Re: about keypress in keyascii

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/
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Zermoth is offline Offline
8 posts
since Dec 2008
Dec 10th, 2008
0

Re: about keypress in keyascii

Hi,

Change your code to :

vb Syntax (Toggle Plain Text)
  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
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Dec 10th, 2008
0

Re: about keypress in keyascii

thnx
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Help with displaying random numbers
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Superscript Text in Name of TextBoxes, Lables & Buttons etc





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC