CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Location
    Georgia
    Posts
    107

    Buttons and key events

    Hello I have a problem with my program.
    I have my program setup to do a certain task when the 'enter' key is pressed. But if a button on the form has focus then that button is pressed when the enter key is pressed and ultimately the keyevent is not prossed. Is there a way to prosses all keyevents regardless of button focus.

  2. #2
    Join Date
    Dec 2002
    Location
    On the deep blue sea
    Posts
    52
    Turn the Form's KeyPreview property to True. This allows the form to capture keystrokes before they are processed by the control on the form. To run the code whenever the "Enter" key is pressed, you will have to place the code in the KeyUp/Down/Press event of the form.
    A man without a woman is like a neck without a pain...

    Never try to teach a pig to sing. It wastes your time and annoys the pig.

  3. #3
    Join Date
    Apr 2003
    Location
    Georgia
    Posts
    107
    thank you very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured