How to key preview a Tab key?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dean Slindee

    How to key preview a Tab key?

    I have placed this statement in the form_load event:
    Me.KeyPreview = True

    and created this event handler and set a breakpoint on e.Handled = False:
    Private Sub frmJusticeClien tReferral_KeyDo wn(ByVal sender As Object,
    ByVal e As KeyEventArgs) Handles MyBase.KeyDown
    e.Handled = False
    End Sub

    But, a tabbing out of a combobox or a textbox is not trapped by the above.

    This is an attempt to locate the cause of the real problem, which is this:
    1. A rectangle has been painted on the form in form_load (note, this
    rectangle is a graphic, not a control)
    2. The very first time a tab button is depressed, the rectangle disappears.
    3. Repaint the rectangle, and it never disappears again.
    4. Relaunch the form and the whole cycle restarts. Other keys (shift,
    letters) are trapped.

    Any ideas about the problem, or how to trap the tab key would be
    appreciated.

    Thanks in advance,
    Dean S

  • Teemu

    #2
    Re: How to key preview a Tab key?


    "Dean Slindee" <slindee@charte r.netkirjoitti viestissä
    news:8584E635-F767-449A-8965-C3F02B6791D7@mi crosoft.com...
    1. A rectangle has been painted on the form in form_load (note, this
    rectangle is a graphic, not a control)
    It should be drawn in Paint event. If you try to move another form above
    your form you will see how your drawing will vanish. This won't happen if
    you place the drawing method in to Paint event.

    Another solution is to create a bitmap while running your application and
    place that in Form's BackgroundImage .

    -Teemu

    Comment

    • Teemu

      #3
      Re: How to key preview a Tab key?


      "Teemu" <tsirkia@hotmai l.comkirjoitti viestissä
      news:GAXtj.2982 59$6c2.65481@re ader1.news.saun alahti.fi...
      If you try to move another form above your form you will see how your
      drawing will vanish.
      Or a better way to see this is to drag your form so that only the caption
      can be seen and the rest of the form is below the screen area.

      -Teemu

      Comment

      Working...