473,408 Members | 1,907 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,408 software developers and data experts.

Ascii Codes

sgrec7
59
hi guys,

hey i looked everywere and i can't for the life of me find the ascii codes for these keys:

ctrl (the control button, bottom left corner of keyboard)

alt (the alt button, either side of the spacebar)

thanks guys, even if you link me the URL for a site that will help

thanks again in advance

sgrec7
Sep 3 '07 #1
13 3012
kadghar
1,295 Expert 1GB
hi guys,

hey i looked everywere and i can't for the life of me find the ascii codes for these keys:

ctrl (the control button, bottom left corner of keyboard)

alt (the alt button, either side of the spacebar)

thanks guys, even if you link me the URL for a site that will help

thanks again in advance

sgrec7
ctrl ---> 17
alt ---> 18

you can have it on a text box if you write in some other controls KeyDown event something like

textbox1.text = keycode

then just select that control an press the key you want to know ;)
Sep 4 '07 #2
Killer42
8,435 Expert 8TB
These keys don't have ASCII codes.

ASCII defines values for the character set. These are keyboard keys, not characters.

The difference between KeyDown and KeyPress events is that one reports the actual key pressed, while the other reports the ASCII character which was generated as a result. For example, pressing the "A" key generates the keycode for that key (65). Depending on the current state of the Caps-Lock, Shift, Control and Alt and Shift keys, the ASCII character generated might be...
"A" (code 65), "a" (code 97), "Ctrl-A" (code 1) or whatever.
This is why keys such as Shift, Alt and so on do not trigger a KeyPress event.
Sep 4 '07 #3
sgrec7
59
yea thanks guys...

i want to use alt and ctrl in a keyprss event

will it still work ???
Sep 4 '07 #4
hariharanmca
1,977 1GB
yea thanks guys...

i want to use alt and ctrl in a keyprss event

will it still work ???
You can try Key down and key up event using

KeyCode = vbKeyControl ==>> Control
KeyCode = vbKeyMenu ==>> Alt

there you find two perameter for key pressed and shift pressed

I think this will help you.
Sep 4 '07 #5
Killer42
8,435 Expert 8TB
i want to use alt and ctrl in a keyprss event
Are you sure you can't do it in the KeyDown or KeyUp event?

If you want, you can put code in your KeyPress event procedure to test the current state of these keys. I forget how, but detecting the current state of keys was covered here not too long ago. Maybe a couple of months back. Try some searches.
Sep 4 '07 #6
QVeen72
1,445 Expert 1GB
Hi,

U have to check the Shift in KeyUp event :
Values would be:
A C S
4 2 1

Expand|Select|Wrap|Line Numbers
  1. Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
  2.   Select Case Shift
  3.          Case 1
  4.              MsgBox "Shift Pressed"
  5.          Case 2
  6.              MsgBox "Control Pressed"
  7.          Case 3
  8.              MsgBox "Shift + Control Pressed"
  9.          Case 4
  10.              MsgBox "Alt Pressed"
  11.          Case 5
  12.              MsgBox "Alt + Shift Pressed"
  13.          Case 6
  14.              MsgBox "Alt+Control Pressed"
  15.         Case 7
  16.              MsgBox "Alt+Shift+Control Pressed"
  17.   End Select
  18. End Sub
  19.  
REgards
Veena
Sep 4 '07 #7
Killer42
8,435 Expert 8TB
There's also an API function you can call to check the current key state. I just don't remember what it's called.
Sep 4 '07 #8
sgrec7
59
Are you sure you can't do it in the KeyDown or KeyUp event?

If you want, you can put code in your KeyPress event procedure to test the current state of these keys. I forget how, but detecting the current state of keys was covered here not too long ago. Maybe a couple of months back. Try some searches.
or you could just tell me !!! :-) that would be MUCH easer... for me !!! :-)
Sep 5 '07 #9
Killer42
8,435 Expert 8TB
or you could just tell me !!! :-) that would be MUCH easer... for me !!! :-)
It certainly would. If I could remember it. I do remember it had "Asynch" in the name, but that's probably not a lot of help.
Sep 5 '07 #10
Killer42
8,435 Expert 8TB
Ok, I spent some time searching, and managed to track down the thread I was thinking of. Here it is.

I hope it's some help.
Sep 5 '07 #11
QVeen72
1,445 Expert 1GB
or you could just tell me !!! :-) that would be MUCH easer... for me !!! :-)
Hi,

did u check my post above...?


Regards
Veena
Sep 5 '07 #12
kadghar
1,295 Expert 1GB
or you could just tell me !!! :-) that would be MUCH easer... for me !!! :-)
In my first post i wrote what the KeyCode were, and as Killer said, they dont have an ascii code, only a KeyCode. (the keycodes are 17 and 18), and im not sure they'll work in keypress, you should use them in keydown
Sep 5 '07 #13
sgrec7
59
In my first post i wrote what the KeyCode were, and as Killer said, they dont have an ascii code, only a KeyCode. (the keycodes are 17 and 18), and im not sure they'll work in keypress, you should use them in keydown
Thanks to all of you, but after reading through all that I think we will come to an agreement that space bar (32) will be much easier to deal with

thanks to you all again

sgrec7
Sep 5 '07 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Randell D. | last post by:
Folks, I have two related questions: 1. I have seen unicode being mentioned in my javascript pocket book - is this the same as ascii codes? I think not though I'm not sure and I can't find...
37
by: chandy | last post by:
Hi, I have an Html document that declares that it uses the utf-8 character set. As this document is editable via a web interface I need to make sure than high-ascii characters that may be...
2
by: Martín Marconcini | last post by:
Hello there, I'm writting (or trying to) a Console Application in C#. I has to be console. I remember back in the old days of Cobol (Unisys), Clipper and even Basic, I used to use a program...
11
by: Kai Bohli | last post by:
Hi all ! I need to translate a string to Ascii and return a string again. The code below dosen't work for Ascii (Superset) codes above 127. Any help are greatly appreciated. protected...
3
by: JSM | last post by:
Hi, I am just trying to port an existing simple encryption routine to C#. this routine simply adds/substracts 10 ascii characters to each character in a text file (except quotes). The routine...
31
by: Claude Yih | last post by:
Hi, everyone. I got a question. How can I identify whether a file is a binary file or an ascii text file? For instance, I wrote a piece of code and saved as "Test.c". I knew it was an ascii text...
9
by: simchajoy2000 | last post by:
Hi, I know what the ASCII Character Codes are for the 2nd and 3rd powers in VB.NET but I can't find the 6th power anywhere - does anyone know what it might be or if it even exists? Joy
19
by: many_years_after | last post by:
Hi,everyone: Have you any ideas? Say whatever you know about this. thanks.
6
by: Andy Leese | last post by:
Beginner Question: ASCII Symbols I am using Borland C++ and programming under DOS. I wish to display the symbols of the early ASCII character set... For example: cout << char(7); ...
9
by: =?Utf-8?B?RGFu?= | last post by:
I have the following code section that I thought would strip out all the non-ascii characters from a string after decoding it. Unfortunately the non-ascii characters are still in the string....
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.