473,554 Members | 2,452 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Arrow key does not fire keyDown-event

Hi!

Very simple Application:

-------------------------------
this.KeyDown += new
System.Windows. Forms.KeyEventH andler(this.For m1_KeyDown);

[...]

private void Form1_KeyDown(o bject sender,
System.Windows. Forms.KeyEventA rgs e)
{
this.label1.Tex t=" --> "+ e.KeyData.ToStr ing();
}
-----------------------------------

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 5100
You need to catch the KeyUp event. this worked for me:

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

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

Very simple Application:

-------------------------------
this.KeyDown += new
System.Windows. Forms.KeyEventH andler(this.For m1_KeyDown);

[...]

private void Form1_KeyDown(o bject sender,
System.Windows. Forms.KeyEventA rgs e)
{
this.label1.Tex t=" --> "+ e.KeyData.ToStr ing();
}
-----------------------------------

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
22547
by: Bob | last post by:
well i pretty much said it in the title. i was wondering how would you make a picture box or an object repond to the arrow keys. for example i have a picture and i want to move right when i press the right arrow on my keyboard. what is code for that? if anyones knows the code please answer.
0
3244
by: Paul Nathan | last post by:
While trying to write a simple game which uses the arrow keys, I noticed that under the subroutine that handles mybase.keydown, everytime I pressed any arrow keys, or in fact any of the 9 keys above it (End, Del, PGDN etc) that the result for e.keycode was 'none', yet it still picked up my keypress! All other keys work fine. This problem...
2
8097
by: Darren Oakey | last post by:
ok - the problem - I made a simple breakout game out of a form, just painting the background - and using keydown for left and right arrow keys to control the bat - worked fine. I then moved all the code into a user control, put it on the form. Now I don't get keydown events when I press an arrow key - on either the form or the usercontrol...
0
1117
by: meicher | last post by:
Hi, I have an application with forms. Every form includes a VScrollBar and a HScrollBar. The ScrollBars allways get the arrow keys and start blinking ? How can I catch these key events ? KeyUp, KeyDown, KeyPress, Handled = true, KeyPreview = true, ProcessKeyMessage etc. don't help. :( Regards mike
11
2782
by: Rlrcstr | last post by:
How can you detect when an arrow key gets pressed? Doesn't seem to trigger a KeyPress or KeyDown event. Thanks. Jerry
5
1448
by: Ivan V via DotNetMonster.com | last post by:
Hi I would like to knwo if I could activate the up and down arrow in a window form which have the same function as using the tab button. Thanks for all! best rgds, Ivan Vong -- Message posted via DotNetMonster.com http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-vb-net/200508/1
2
5948
by: gv | last post by:
Hi all, Using VB 2005 Express When pressing the down key in a listbox and getting to the last item I want to move right back to the top and vise versa so it never stops when pressing the arrow keys. The code below moves it when it gets to the end of the list biut skips the first item
1
10129
by: Martijn Mulder | last post by:
/* I have problems detecting the Arrow Keys on a User Control. A control derived from System.Windows.Forms.Control neglects 'bare' Arrow Keys but does react on the combination <Altor <Ctrl+ Arrow Key. The code below shows what I mean. How can I cure this? (excuse me for the line breaks) */
0
2907
by: Martijn Mulder | last post by:
/* I override IsInputKey() to direct the Arrow Keys (Cursor Keys) to my custom System.Windows.Forms.Control. But, holding down the Shift-Key prevents the Arrow Keys from coming through. How can I intercept the Arrow Keys when holding down the Shift Key? */
5
4282
by: T | last post by:
Hi, How do I fire the KeyDown event in Managed VC++? I am getting a compile error saying "event does not have a raise method". Please help. regards, T
0
7615
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7539
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7819
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8055
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7581
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7897
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6170
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
2030
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
858
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.