471,350 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Arrow key does not fire keyDown-event

Hi!

Very simple Application:

-------------------------------
this.KeyDown += new
System.Windows.Forms.KeyEventHandler(this.Form1_Ke yDown);

[...]

private void Form1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
this.label1.Text=" --> "+ e.KeyData.ToString();
}
-----------------------------------

Every key on my keyboard works but the arrow keys (up,down, left,
right) doesnt.
Funny: When pressing "Strg" or "Alt" and Arrow Keys the Event is fired.

Any suggestions?

Arne

Nov 29 '05 #1
2 4910
You need to catch the KeyUp event. this worked for me:

private void myTextBox_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyData == Keys.Down )
{
//do something
}
}

"an*******@gmx.de" wrote:
Hi!

Very simple Application:

-------------------------------
this.KeyDown += new
System.Windows.Forms.KeyEventHandler(this.Form1_Ke yDown);

[...]

private void Form1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
this.label1.Text=" --> "+ e.KeyData.ToString();
}
-----------------------------------

Every key on my keyboard works but the arrow keys (up,down, left,
right) doesnt.
Funny: When pressing "Strg" or "Alt" and Arrow Keys the Event is fired.

Any suggestions?

Arne

Nov 29 '05 #2
Thanks a lot! It works!

Nov 29 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Paul Nathan | last post: by
2 posts views Thread by Darren Oakey | last post: by
reply views Thread by meicher | last post: by
11 posts views Thread by Rlrcstr | last post: by
5 posts views Thread by Ivan V via DotNetMonster.com | last post: by
1 post views Thread by Martijn Mulder | last post: by
reply views Thread by Martijn Mulder | last post: by
5 posts views Thread by T | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.