| | |
KeyPress event not working
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
Hey. I'm having a problem. In a form's constructor, I have:
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...
C# Syntax (Toggle Plain Text)
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.
try:
If it doesnt work, show me the rest of the program; as the error is not in that line.
C# Syntax (Toggle Plain Text)
this.KeyPress+=new KeyEventHandler(frmGScreen_KeyDown)
![]() |
Similar Threads
- KeyPress event with holding down the key (Python)
- event code not working (Java)
- Form1.KeyDown Event Problems (VB.NET)
Other Threads in the C# Forum
- Previous Thread: How to load multiple images on the form?
- Next Thread: Delegate
| Thread Tools | Search this Thread |
.net access algorithm array asp.net barchart bitmap box broadcast buttons c# check checkbox client combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime dbconnection degrees design development draganddrop drawing encryption enum event eventhandlers excel file firefox form format forms function gdi+ grantorrevokepermissionthroughc#.net httpwebrequest image index input install java label libraries list listbox loop mandelbrot math mouseclick movingimage mysql mysql.data.client operator path photoshop picturebox pixelinversion platform post programming radians regex remote remoting resourcefile richtextbox server sleep socket sql statistics stream string system.servicemodel table tcpclientchannel text textbox thread time timer update usercontrol validation visualstudio webbrowser windows winforms wpf wpfc# xml






