|
-
Dec 14th, 2001, 05:23 AM
#1
Thread Starter
Addicted Member
-
Dec 14th, 2001, 05:28 AM
#2
-
Dec 14th, 2001, 05:32 AM
#3
PowerPoster
hi
Ascii code I think its 8.
-
Dec 14th, 2001, 05:59 AM
#4
New Member
Hi!
Yes its ascii code is 8
here is a code for finding ascii code for any keypress
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
MsgBox KeyCode
End Sub
try it
pari
-
Dec 14th, 2001, 06:35 AM
#5
Here is all ASCII code with DESCRIPTIONS : http://www.bbsinc.com/iso8859.html
-
Dec 14th, 2001, 07:03 AM
#6
Nice reference link DaoK!
-
Dec 14th, 2001, 07:32 AM
#7
Thread Starter
Addicted Member
-
Dec 14th, 2001, 07:36 AM
#8
Thread Starter
Addicted Member
1 more stupid question and i can work on, how can i limit a textbox to, let's say 3 chars?
-
Dec 14th, 2001, 07:38 AM
#9
Conquistador
Originally posted by pari
Hi!
Yes its ascii code is 8
here is a code for finding ascii code for any keypress
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
MsgBox KeyCode
End Sub
try it
pari
that just displays key codes not ascii codes,
from memory it is
Private Sub Text1_KeyPress(KeyAscii As Integer, Shift As Integer)
MsgBox KeyAscii
End Sub
-
Dec 14th, 2001, 08:00 AM
#10
PowerPoster
Set the "MaxLength" property of the textbox to 3 like this:
-
Dec 14th, 2001, 08:03 AM
#11
Conquistador
that's the best way, or u could add handling on the keypress.....
-
Dec 14th, 2001, 09:01 AM
#12
If you are going to limit the text length at the control level, then you need to code both the KeyPress for keyboard input, and the change event for pasted input. abdul has the easiest suggestion however. If you just set that MaxLength property at design time, then you don't have to worry about either the Change or the KeyPress event. The disadvantage to that is you can't throw a message box or something at the user telling them they have reached the MaxLength.
-
Dec 14th, 2001, 09:15 AM
#13
Conquistador
try this if you want to do what hack says:
VB Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Len(Text1) = 3 And KeyAscii <> vbKeyBack Then
KeyAscii = 0
MsgBox "You have reached the maximum length :)"
Exit Sub
End If
End Sub
-
Dec 14th, 2001, 12:48 PM
#14
Here is a trick I have when I program when I do not have Internet and I need to know an ASCII number.
Here is the code :
VB Code:
Private Sub Form_Load()
For i = 0 To 255
List1.AddItem ("->" & Format(i, "000") & " = " & Chr(i))
Next
End Sub
Just add a Listbox and here you go
-
Dec 14th, 2001, 07:56 PM
#15
Conquistador
that won't tell you the ascii key for backspace
if anything, you just put in the keypress event
debug.print keyascii
then when you know what key you pressed e.g. backspace, and you find out its ascii code
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|