Click here to Skip to main content
15,902,445 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i would like to know the ascii value of alt key
Posted

The ALT key does not have an ASCII value: it is a modifier key and doesn't not affect ASCII values.

If you want to know if the ALT key is pressed, use Control.Keys in Winforms:

C#
if ((Control.ModifierKeys & Keys.Alt) != 0)
    {
    MessageBox.Show("AltDown");
    }
In web, you can't tell at all - it does not leave the browser (and the end equipment may not even have an ALT key).
 
Share this answer
 
The alt key doesn't have an ASCII representation. It's a virtual key code, and they don't actually correspond to any characters. Have a read of this[^] article for more information.
 
Share this answer
 
The ALT key does not have an ASCII value: it is a modifier key and does't not affect ASCII values.


Put this code in keydown even in control or form


Messagebox.show(e.KeyCode.ToString());


You will get answer yourself....


Any query contact me through mail.
[Removed]

myfrnz.tk

Arun Vasu
Kerala.
 
Share this answer
 
v2
Comments
lewax00 6-Aug-12 10:30am    
Please don't post your email here, you're only inviting spam. And you will receive an email when your post is replied to anyways.
Because the ALT key doesn't have a ASCII value,
you can use this code if you want to know
when the ALT key is pressed (in Windows Forms):

C#
public Form1()
{
       // design your form
       // after all design methods, add a KeyEventHandler:
       this.KeyDown += new KeyEventHandler(Form1_KeyDown);
}
void Form1_KeyDown(object sender, KeyEventArgs e)
{
       if (e.Alt)
       {
           MessageBox.Show("Alt key pressed");
       }
}
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900