PC Review


Reply
Thread Tools Rate Thread

Do the "cursor press"

 
 
Bob Achgill
Guest
Posts: n/a
 
      13th May 2004
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
' ++++++++++++++++++++++++++++++++++++++++++++++++

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QW5hbmRbTVZQfQ==?=
Guest
Posts: n/a
 
      13th May 2004
You could see if a Keyboad hook helps.

This KB(http://support.microsoft.com/default...;EN-US;Q319524) is about a mouse hook, but you can also hook into keyboard messages. When you hook, you will always get the message irrespective of the control. It is more complex and not as easy as the keypreview, but then you have more power than with keypreview.

Rgds,
Anand M
VB.NET MVP
http://www.dotnetindia.com

"Bob Achgill" wrote:

> 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
> ' ++++++++++++++++++++++++++++++++++++++++++++++++
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"ListBox DoubleClick" doesn't handle "select, then press Enter" Zytan Microsoft C# .NET 3 5th Apr 2007 01:04 AM
When I press "spacebar" or "Enter" in PowerPoint 2003 it becomes . =?Utf-8?B?YW5kcmU=?= Microsoft Powerpoint 0 17th Dec 2004 10:59 AM
When I press "spacebar" or "Enter" in PowerPoint 2003 it becomes . =?Utf-8?B?YW5kcmU=?= Microsoft Powerpoint 0 17th Dec 2004 10:59 AM
How can I use the press "Enter" to move the cursor to the subform from the master form new.microsoft.com Microsoft Access Forms 2 7th Jan 2004 04:17 PM
Scheduled Task : Press "Yes" Control Pop-Up Automatically for a "Delete" SQL event A Techie Microsoft Access Forms 2 1st Nov 2003 01:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:57 AM.