473,388 Members | 1,385 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,388 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 28236
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.