473,419 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

vbkey codes??

H
Anyone know the code for " ` " (left quote?).. Its the key in the top left
hand corner under the escape key.... (UK keyboard, others might be
different?)

Found all the ordinary ones, but havent a clue for this one! Found a site
that says its 96? How do I assign this?

Sorry for this post, im new to trapping keyboard events..

Ta!
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
Jul 17 '05 #1
9 28240
There are occasional variations in KeyCodes
with different countries. I'm not sure about ASCII.
For the accent character it's ASCII 96, which is
connected with KeyPress. The KeyCode is 192,
connected with key up and key down.
You can check any of them easily. Just start a project,
add a text box, and add this code:

Private Sub Text1_KeyPress(KeyAscii As Integer)
Debug.Print "Ascii: " & CStr(KeyAscii)
End Sub

Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
Debug.Print "Keycode: " & CStr(KeyCode)
End Sub

That will print the numbers in the debug window as you type
in the textbox.
Anyone know the code for " ` " (left quote?).. Its the key in the top left hand corner under the escape key.... (UK keyboard, others might be
different?)

Found all the ordinary ones, but havent a clue for this one! Found a site
that says its 96? How do I assign this?

Sorry for this post, im new to trapping keyboard events..

Ta!
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004

Jul 17 '05 #2
in the keypress and/or keydown event on a form with keypreview set to true,
add:

debug.print keycode

or

debug.print keyasii

... as appropriate to view the key codes pressed.

--

Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"H" <H@opijpoijpoij.com> wrote in message
news:0i********************@karoo.co.uk...
: Anyone know the code for " ` " (left quote?).. Its the key in the top
left
: hand corner under the escape key.... (UK keyboard, others might be
: different?)
:
: Found all the ordinary ones, but havent a clue for this one! Found a site
: that says its 96? How do I assign this?
:
: Sorry for this post, im new to trapping keyboard events..
:
: Ta!
:
:
: ---
: Outgoing mail is certified Virus Free.
: Checked by AVG anti-virus system (http://www.grisoft.com).
: Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
:
:

Jul 17 '05 #3
H
Thanks guys, but how to I implement this? Heres a bit of code..

Select Case KeyCode
Case vbKeyC
x = MsgBox("You pressed C") ' Works
Case 192
x = MsgBox("You pressed ' ") ' dont work
End Select

When I use the code below to find keycodes, nothing appears..

Debug.Print "Keycode: " & CStr(KeyCode)

Except for "Keycode".

Sorry for being a pain.

"Randy Birch" <rg************@mvps.org> wrote in message
news:zR**************@news04.bloor.is.net.cable.ro gers.com...
in the keypress and/or keydown event on a form with keypreview set to
true,
add:

debug.print keycode

or

debug.print keyasii

.. as appropriate to view the key codes pressed.

--

Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"H" <H@opijpoijpoij.com> wrote in message
news:0i********************@karoo.co.uk...
: Anyone know the code for " ` " (left quote?).. Its the key in the top
left
: hand corner under the escape key.... (UK keyboard, others might be
: different?)
:
: Found all the ordinary ones, but havent a clue for this one! Found a
site
: that says its 96? How do I assign this?
:
: Sorry for this post, im new to trapping keyboard events..
:
: Ta!
:
:
: ---
: Outgoing mail is certified Virus Free.
: Checked by AVG anti-virus system (http://www.grisoft.com).
: Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
:
:

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
Jul 17 '05 #4
"KeyCode" in that case is a parameter of the
textbox KeyUp event. It works in the textbox KeyUp
sub. You sample doesn't indicate where you're
trying to use it, but presumably you're trying to catch
the keycode for text entered into a specific control,
like a textbox. So you need to catch it there.

Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
--
--
H <H@opijpoijpoij.com> wrote in message
news:F9********************@karoo.co.uk...
Thanks guys, but how to I implement this? Heres a bit of code..

Select Case KeyCode
Case vbKeyC
x = MsgBox("You pressed C") ' Works
Case 192
x = MsgBox("You pressed ' ") ' dont work
End Select

When I use the code below to find keycodes, nothing appears..

Debug.Print "Keycode: " & CStr(KeyCode)

Except for "Keycode".

Sorry for being a pain.

"Randy Birch" <rg************@mvps.org> wrote in message
news:zR**************@news04.bloor.is.net.cable.ro gers.com...
in the keypress and/or keydown event on a form with keypreview set to
true,
add:

debug.print keycode

or

debug.print keyasii

.. as appropriate to view the key codes pressed.

--

Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"H" <H@opijpoijpoij.com> wrote in message
news:0i********************@karoo.co.uk...
: Anyone know the code for " ` " (left quote?).. Its the key in the top
left
: hand corner under the escape key.... (UK keyboard, others might be
: different?)
:
: Found all the ordinary ones, but havent a clue for this one! Found a
site
: that says its 96? How do I assign this?
:
: Sorry for this post, im new to trapping keyboard events..
:
: Ta!
:
:
: ---
: Outgoing mail is certified Virus Free.
: Checked by AVG anti-virus system (http://www.grisoft.com).
: Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
:
:

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004

Jul 17 '05 #5
H

"mayayana" <ma**********@mindYYspring.com> wrote in message
news:jm****************@newsread2.news.atl.earthli nk.net...
"KeyCode" in that case is a parameter of the
textbox KeyUp event. It works in the textbox KeyUp
sub. You sample doesn't indicate where you're
trying to use it, but presumably you're trying to catch
the keycode for text entered into a specific control,
like a textbox. So you need to catch it there.

Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)


Hi, its used on a form in Keydown.. Ive already set KeyPreview to true
and all of the actual vbkeys work, just dosent want to let me put a number
in there instead!

I'll go spend some more time nutting the wall!

Thanks.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
Jul 17 '05 #6

"H" <H@opijpoijpoij.com> skrev i en meddelelse
news:0i********************@karoo.co.uk...
Anyone know the code for " ` " (left quote?).. Its the key in the top left hand corner under the escape key.... (UK keyboard, others might be different?)

Found all the ordinary ones, but havent a clue for this one! Found a site that says its 96? How do I assign this?


Debug.Print Asc("`")

:)

--
/\ preben nielsen
\/\ pr**@post.tele.dk
Jul 17 '05 #7
I just tried it and it worked fine in the Form_KeyDown sub.
If I use debug.print cstr(keycode) in that sub I get 192.
If you want to trap specific keys you can do it with
Select Case. You can then check Shift to find whether the accent
character or the tilde was typed.

Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = 0 then '-- Shift key not pressed
Select Case Keycode
Case 192 '-- accent
msgbox "Accent character."
Case 190 '-- period
msgbox "Period was typed."
Case 32 '-- space
msgbox "Space was typed."
...etc.......
End Select
End If
End Sub
--
--
H <H@opijpoijpoij.com> wrote in message
news:sL********************@karoo.co.uk...

"mayayana" <ma**********@mindYYspring.com> wrote in message
news:jm****************@newsread2.news.atl.earthli nk.net...
"KeyCode" in that case is a parameter of the
textbox KeyUp event. It works in the textbox KeyUp
sub. You sample doesn't indicate where you're
trying to use it, but presumably you're trying to catch
the keycode for text entered into a specific control,
like a textbox. So you need to catch it there.

Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)


Hi, its used on a form in Keydown.. Ive already set KeyPreview to true
and all of the actual vbkeys work, just dosent want to let me put a number
in there instead!

I'll go spend some more time nutting the wall!

Thanks.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004

Jul 17 '05 #8
H
Thankyou, Ive got it now! On my keyboard (UK) the code is 223.. But
im also going to include 192 for compatibility with others.

Thanks so much for you time guys.

Hellen.

"mayayana" <ma**********@mindYYspring.com> wrote in message
news:KG*****************@newsread2.news.atl.earthl ink.net...
I just tried it and it worked fine in the Form_KeyDown sub.
If I use debug.print cstr(keycode) in that sub I get 192.
If you want to trap specific keys you can do it with
Select Case. You can then check Shift to find whether the accent
character or the tilde was typed.

Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = 0 then '-- Shift key not pressed
Select Case Keycode
Case 192 '-- accent
msgbox "Accent character."
Case 190 '-- period
msgbox "Period was typed."
Case 32 '-- space
msgbox "Space was typed."
...etc.......
End Select
End If
End Sub
--
--
H <H@opijpoijpoij.com> wrote in message
news:sL********************@karoo.co.uk...

"mayayana" <ma**********@mindYYspring.com> wrote in message
news:jm****************@newsread2.news.atl.earthli nk.net...
> "KeyCode" in that case is a parameter of the
> textbox KeyUp event. It works in the textbox KeyUp
> sub. You sample doesn't indicate where you're
> trying to use it, but presumably you're trying to catch
> the keycode for text entered into a specific control,
> like a textbox. So you need to catch it there.
>
> Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
>


Hi, its used on a form in Keydown.. Ive already set KeyPreview to true
and all of the actual vbkeys work, just dosent want to let me put a
number
in there instead!

I'll go spend some more time nutting the wall!

Thanks.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
Jul 17 '05 #9
Thankyou, Ive got it now! On my keyboard (UK) the code is 223.. But
im also going to include 192 for compatibility with others.


In that case you might also want to check other
keys that you're using. (I have an editor program
that traps the period character and occasionally
get emails from Europeans. It seems that on some
keyboards the US period (190) is the semi-colon.)

I looked up in MSDN and found a list of VB
keycode constants. You can also find them under
"VBRUN" "global" in the object browser, but the
punctuation keys don't seem to be in either list.

Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Michael Bendzick | last post by:
Is there a simple way in python to read a keyboard scan code? I'm working on a shell script that interfaces with a proprietary keyboard device (extra buttons) and need to be able to distinguish...
1
by: Yong Wang | last post by:
Hi, All: We have a network management system written in C++, MysQL, and Hp SNMP. It works in Solaris command line. When I wrote a similar python codes which call compiled C++ and mysql codes in...
8
by: Shane Groff | last post by:
I know this is a recurring discussion (I've spent the last 3 days reading through threads on the topic), but I feel compelled to start it up again. After reading through the existing threads, I...
6
by: Josh Mcfarlane | last post by:
I keep trying to get myself out of the return-code mindset, but it doesn't seem to work. They are suppose to get rid of if-then statements of return codes, but you still have to do an if statement...
3
by: aman | last post by:
i know how to get scan codes and ascii codes for special keys. i can get ascii codes of alphabetic keys. how does one get scan codes of alphabetic keys??
18
by: Steve Litvack | last post by:
Hello, I have built an XMLDocument object instance and I get the following string when I examine the InnerXml property: <?xml version=\"1.0\"?><ROOT><UserData UserID=\"2282\"><Tag1...
3
by: c# beginner | last post by:
we are trying to standardize return codes across our .NET applications (that are soon to be developed.) What is the best practice for standardizing return codes? I know of only the following...
3
by: PerlPhi | last post by:
hi! i have a Perl code in here that when ran the program accepts any Perl codes from the user input (<STDIN>, of course use no syntax errors), then after breaking the multiline input, the inputs will...
5
by: =?GB2312?B?17/HvyBaaHVvLCBRaWFuZw==?= | last post by:
Hi, I would like to have someone comments on what's the best practice defining error codes in C. Here's what I think: solution A: using enum pros: type safe. better for debug (some debugger...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.