CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Location
    Netherlands
    Posts
    181

    KeyPreview and UserControl

    Hi
    I'm having a slighly problem with the keypreview of a form when using a custom control with a textbox on it.
    When I set the keypreview to true, it works pretty fine, except for the cursorkeys (vbKeyUp and vbKeyDown to be exact). And those are the ones I want to have in the form_keypress...
    It seems that these keys aren't passed to the form. But, with a regular textbox, things work fine... In the keydown/press of the usercontrol, it works fine... but I don't want to check in all keydown/press events to see if the cursorkey was pressed (why else do we have the keypreview...)
    Has anyone figured a workaround for this?
    Tnx in advance

    Crazy D :-)

  2. #2
    Join Date
    Mar 2002
    Location
    Holland
    Posts
    279
    Hi,

    I had the same problem..
    my solution was inserting a event KeyDown(KeyCode As Integer, Shift As Integer).
    in every control event I called the function :
    ReactToKeyDown(KeyCode As Integer, Shift As Integer)

    this solved my problem..

    hope it helps,

    Jewe
    A VB programmer trying to stay alive in a Real C World

    If the hardware is so great.. why use software to correct it..?? It will only slow it down..
    Al is de hardware nog zo snel de software achterhaalt het wel

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