473,513 Members | 2,456 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

keydown event

I have a simple windows app. On the form, I have one panel which displays
an image. I have a KeyDown event that I use to tweek the image depending on
which keys are hit. ie. ctrl-D, ctrl-A, etc. Works fine so far.

Now I've added a textbox (and there will be other controls) to the form, not
the panel. My KeyDown event no longer triggers. How do I get this event
to work if my mouse pointer is over the panel?

Thanks.

Things I've Tried:
-On the mouse move event for the panel, tried to setfocus to the panel.
cursor leaves the text box, but that's it.
-putting the controls into their own panel...nada.
Nov 21 '05 #1
2 1489
"Rob T" <RT*********@DONTwalchemSPAM.com> schrieb:
I have a simple windows app. On the form, I have one panel which displays
an image. I have a KeyDown event that I use to tweek the image depending
on which keys are hit. ie. ctrl-D, ctrl-A, etc. Works fine so far.

Now I've added a textbox (and there will be other controls) to the form,
not the panel. My KeyDown event no longer triggers. How do I get this
event to work if my mouse pointer is over the panel?


Set the form's 'KeyPreview' property to 'True' and capture the events in the
form's keyboard events.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
Thank you! That was too easy!

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
"Rob T" <RT*********@DONTwalchemSPAM.com> schrieb:
I have a simple windows app. On the form, I have one panel which displays
an image. I have a KeyDown event that I use to tweek the image depending
on which keys are hit. ie. ctrl-D, ctrl-A, etc. Works fine so far.

Now I've added a textbox (and there will be other controls) to the form,
not the panel. My KeyDown event no longer triggers. How do I get this
event to work if my mouse pointer is over the panel?


Set the form's 'KeyPreview' property to 'True' and capture the events in
the form's keyboard events.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9199
by: bardo | last post by:
I have a Datagrid that is inside a panel. I want to use the keyDown event to reconize the arrow keys. But I have no luck at all. The problem is that the keydown event won't fire at all, unless I...
4
13050
by: Tony | last post by:
I'm building a simple "breakout" style video-game, and I want keyboard control of the paddle. What I need is for an event handler to respond whenever a key is pressed, regardless of what the...
4
8610
by: Anne | last post by:
hie again, i have 3 textbox and i would like the user to go to the next textbox by pressing the 'ENTER' key. i have tried using this: Private Sub txtRequestor_KeyDown(ByVal sender As...
4
7118
by: ShaneO | last post by:
I would like to handle the KeyUp & KeyDown events in the same event handler but can't find how to determine which event was fired - Private Sub ListBox1_KeyUp(ByVal sender As Object, ByVal e As...
1
3294
by: fripper | last post by:
I have a VB 2005 windows app and I want to recognize keydown events. I have a form key down event handler but it does not get control when a key is depressed. In playing around I found that if I...
0
1742
by: tony | last post by:
Hello!! I have a derived class called StringClassEditor which inherit from UITypeEditor listed below. Now to my question in method EditValue in this class I have this statement lb.KeyDown ...
3
5237
by: MLM450 | last post by:
I have a control that handles the KeyDown event but it does not seem to execute when a combination of keys is pressed - like CTRL+Z. If I press CTRL, it executes. If I press Z, it executes. But the...
3
4283
by: win | last post by:
when the cursor is in a textbox, only coding in the keydown event of the textbox triggered, the coding in the keydown event of the form does not triggered! Problem: I need to change a VB6 program...
2
19276
by: Tony Johansson | last post by:
Hello! I have created a Control that consist of a label and a textbox.I have called this class ctlLabelTextbox. public partial class ctlLabelTextbox : UserControl { .... } The class that I...
14
2937
by: raylopez99 | last post by:
KeyDown won't work KeyPress fails KeyDown not seen inspired by a poster here:http://tinyurl.com/62d97l I found some interesting stuff, which I reproduce below for newbies like me. The main...
0
7384
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
7537
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...
0
7525
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
5685
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,...
1
5086
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4746
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...
0
3233
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
456
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...

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.