473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Do the "cursor press"

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

Nov 20 '05 #1
1 1200
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
' ++++++++++++++++++++++++++++++++++++++++++++++++

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Christopher Benson-Manica | last post by:
Why isn't there a value for the cursor property that corresponds to "unavailable" (usually the circle with a hash through it)? -- Christopher Benson-Manica | I *should* know what I'm talking...
1
by: Hans Merkl | last post by:
Hi, I have a very old piece of code which supposedly comes from OS/2. It looks like this: class indexTable:std::multimap<Type1,Type2> { };
4
by: McKirahan | last post by:
This is from a previous post entitled "cursor type": "IE 4.0 through 5.5 didn't support the cursor type 'pointer' (only the non-standard 'hand')." How might the following be modified to...
3
by: Aaron Queenan | last post by:
I have a form which performs some asynchronous code. I want to display a wait cursor when it starts, and hide the wait cursor when it has completed. This part works fairly well, using: ...
8
by: Timur Ametov | last post by:
Hallo everybody. I'm using Visual Studio 7 and hier is my question. How can i see in Outputwindow after my Programm ended the message "Press any key to continue". Is it possible? Now this window...
9
by: Susan Rice | last post by:
I'm running a simple win32 console application and I want to impliment a "Press any key to continue", so I print that prompt, and then what's the easiest way to impliment reading any key? Do I use...
12
by: Sculder | last post by:
Hello, I'm running into an interesting issue and I wanted to verify it was a bug with Internet Explorer 7. I have a field that has an javascript onBlur event. When you set focus to the text...
3
by: geddy | last post by:
My OS: Ubuntu 7.04 distribution Mysql: Server version: 5.0.38-Ubuntu_0ubuntu1.2-log Ubuntu 7.04 distribution mysql-python:1.2.2 python:2.5 when I run the following script: import MySQLdb conn...
26
by: Prisoner at War | last post by:
Hello, Everyone: Is there any other values or whatever-it's-called to the cursor property in CSS?? So far, I only know of cursor:pointer (or, for MSIE, cursor:hand).... Any way to load in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.