Do the "cursor press"

B

Bob Achgill

No this is not a new dance.

OK. Am I missing something. The following code captures
the cursor keys alright on the form1 for
everywhere except when the focus is on a DataGrid or
AxWebBrowser.

Yes i have set the KeyPreview property on the form to
true. Almost home!

I saw another post that said that DataGrid was
not behaving with allowing key capture. Maybe this is a
similar problem. Except that I want to capture keys
anywhere on the form.

Is KeyPreview at the form level not all powerful?

' +++++++++++++++++++++++++++++++++++++++++++++++
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e
As System.Windows.Forms.KeyEventArgs) Handles
MyBase.KeyDown

If e.KeyCode = 37 Then ' Cursor left
' [etc.]

If e.KeyCode = 39 Then ' Cursor right
' [etc.]

End Sub
' ++++++++++++++++++++++++++++++++++++++++++++++++
 

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