|
-
Oct 7th, 2000, 07:02 PM
#1
Thread Starter
Frenzied Member
Why doesnt the key delete show up
in keyascii in form_keypress? I
dont need another way to do it though.
-
Oct 7th, 2000, 09:02 PM
#2
The only possibility is that <DELETE> is not a keyascii character value, while the other ones like < <Backspace > is. Oh, well, I guess I shouldn't give an alternative...
-
Oct 8th, 2000, 05:53 AM
#3
Frenzied Member
This is indeed pretty strange!
Code:
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyDelete Then
MsgBox "DELETE!"
End If
End Sub
Private Sub Form_Load()
Me.KeyPreview = True
End Sub
The MsgBox does show up when you press the del (.) button on your numerical pad.. strange...
What's even more strange is that the Form_KeyDown does recognize the delete key...
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyDelete Then MsgBox "delete"
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyDelete Then MsgBox "delete"
End Sub
Private Sub Form_Load()
Me.KeyPreview = True
End Sub
By combing the 2 you can capture both keys!
[Edited by Jop on 10-08-2000 at 06:57 AM]
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Oct 8th, 2000, 02:34 PM
#4
Thread Starter
Frenzied Member
wow..
Hmm..
That is weird..
Thanks!
-
Oct 8th, 2000, 05:15 PM
#5
The Delete key doesn't have an ASCII value, but it does have a key code. The reason the number pad delete works is that this registers as an ASCII key (the . char), and the system checks this against the numlock state to decided if it's actually the delete call or a . code.
the key code set in vb allows you to check for every sort of key stroke. The vbKey... prefix matchs the VK_KEY prefix, which stands for "virtual key".
You can work out the rest 
- gaffa
-
Oct 8th, 2000, 05:48 PM
#6
Jop and Even. Turn your Numlock off and Presto! It works!
-
Oct 8th, 2000, 07:55 PM
#7
Thread Starter
Frenzied Member
Thats weird!
why is that?
-
Oct 9th, 2000, 08:55 AM
#8
Frenzied Member
Gaffa told us already Evan.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Oct 9th, 2000, 02:38 PM
#9
When NumLock is one, we are using the numbers; however when Numlock is off, we use what's written at the bottom of the key.
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
|