How to key preview a Tab key?

D

Dean Slindee

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 frmJusticeClientReferral_KeyDown(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
 
T

Teemu

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
 
T

Teemu

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top