KeyPress event not working

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Feb 2007
Posts: 1,606
Reputation: scru has a spectacular aura about scru has a spectacular aura about 
Solved Threads: 130
Featured Poster
scru's Avatar
scru scru is offline Offline
Posting Virtuoso

KeyPress event not working

 
0
  #1
Apr 2nd, 2007
Hey. I'm having a problem. In a form's constructor, I have:
  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.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 2
Reputation: dahwan is an unknown quantity at this point 
Solved Threads: 1
dahwan's Avatar
dahwan dahwan is offline Offline
Newbie Poster

Re: KeyPress event not working

 
0
  #2
May 20th, 2007
try:
  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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 1,606
Reputation: scru has a spectacular aura about scru has a spectacular aura about 
Solved Threads: 130
Featured Poster
scru's Avatar
scru scru is offline Offline
Posting Virtuoso

Re: KeyPress event not working

 
0
  #3
May 20th, 2007
I guess I should have marked this as solved because i did fix it quit a while ago....cant remember how though..
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 2
Reputation: dahwan is an unknown quantity at this point 
Solved Threads: 1
dahwan's Avatar
dahwan dahwan is offline Offline
Newbie Poster

Re: KeyPress event not working

 
0
  #4
May 20th, 2007
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?
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC