944,155 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Marked Solved
  • Views: 13221
  • C# RSS
Apr 2nd, 2007
0

KeyPress event not working

Expand Post »
Hey. I'm having a problem. In a form's constructor, I have:
C# Syntax (Toggle Plain Text)
  1. this.KeyDown+=new KeyEventHandler(frmGScreen_KeyDown)

but the event handler does not invoke at all when I press a key on the keyboard. I know this because i have the code "txtOutput.Text="Event handler entered" as the first line of the handler, and nothing happens, and besides, the actions coded for specific keys do not execute.

I do have the form's KeyPreview property set to true. So this one truly stumps me. I just don't get it...
Last edited by scru; Apr 2nd, 2007 at 9:05 am.
Similar Threads
Featured Poster
Reputation Points: 975
Solved Threads: 140
Posting Virtuoso
scru is offline Offline
1,624 posts
since Feb 2007
May 20th, 2007
0

Re: KeyPress event not working

try:
C# Syntax (Toggle Plain Text)
  1. this.KeyPress+=new KeyEventHandler(frmGScreen_KeyDown)
If it doesnt work, show me the rest of the program; as the error is not in that line.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
dahwan is offline Offline
2 posts
since May 2007
May 20th, 2007
0

Re: KeyPress event not working

I guess I should have marked this as solved because i did fix it quit a while ago....cant remember how though..
Featured Poster
Reputation Points: 975
Solved Threads: 140
Posting Virtuoso
scru is offline Offline
1,624 posts
since Feb 2007
May 20th, 2007
0

Re: KeyPress event not working

Wow, i didnt realise this thread was so old. Sorry to bring it up again, but i found this thread as i was searching for tutorials on google.
Do you have an IM adress?
Reputation Points: 10
Solved Threads: 1
Newbie Poster
dahwan is offline Offline
2 posts
since May 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: How to load multiple images on the form?
Next Thread in C# Forum Timeline: Delegate





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC