Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2007

Tip: Looking for answers? Try searching our database.

None of the KeyXXX events seem to be firing on my form :-(

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Simon Harvey - 22 Feb 2007 13:30 GMT
Hi All,

I need to submit a form when the user presses enter. No problem I think
to myself - I'll just use the KeyDown event of the form. So I've added
an event handler for that event (and the other Key events) and
everything builds, but I can't seem to get the events to fire :-(

Can anyone think why this might happen? Am I supossed to do this sort of
thing in the Form's Key down event? I need the form to submit no matter
which control on the form has focus.

Many thanks to anyone who can help

Simon
Kevin Spencer - 22 Feb 2007 13:36 GMT
Have you set the Form's KeyPreview proepty to true?

Signature

HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

I had the same problem once. Fixed it using the same solution.

> Hi All,
>
[quoted text clipped - 10 lines]
>
> Simon
Simon Harvey - 22 Feb 2007 16:56 GMT
> Have you set the Form's KeyPreview proepty to true?

Hmm - I'll have a look at that. I've never actually heard of it so the
answers no....

>Add a button control to the form and assign it to the form's
'AcceptButton' property.

I can't - I'm using toolstrip buttons which dont seem to work as the
accept buttons for the form. I'd rather get the keyboard thing working
anyway

:-)

Thanks for your help
Herfried K. Wagner [MVP] - 22 Feb 2007 13:48 GMT
"Simon Harvey" <nothanks@hotmail.com> schrieb:
> I need to submit a form when the user presses enter. No problem I think to
> myself - I'll just use the KeyDown event of the form. So I've added an
> event handler for that event (and the other Key events) and everything
> builds, but I can't seem to get the events to fire :-(

Add a button control to the form and assign it to the form's 'AcceptButton'
property.

Signature

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.