473,503 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

KeyPreview property

"Forms provide a Boolean KeyPreview property. If you set this to true, your
form receives key press events when any of its controls have focus, and it
receives these events before the control does. This technique is useful if
you are programming a customized interface or a game where you need to take
complete control of the keyboard."

Could someone please explain with a simple example. I tried, but couldn't.

Many thanks.
Nov 16 '05 #1
3 7131
Hi
check this link for sample code

http://msdn.microsoft.com/library/de...eviewTopic.asp

-Benny

Patrick de Ridder wrote:
"Forms provide a Boolean KeyPreview property. If you set this to true, your
form receives key press events when any of its controls have focus, and it
receives these events before the control does. This technique is useful if
you are programming a customized interface or a game where you need to take
complete control of the keyboard."

Could someone please explain with a simple example. I tried, but couldn't.

Many thanks.


Nov 16 '05 #2
Elp

"Benny Mathew" <be************@yahoo.com> wrote in message
news:em****************@TK2MSFTNGP10.phx.gbl...
Hi
check this link for sample code

http://msdn.microsoft.com/library/de...eviewTopic.asp


by the way, i've tried to use that in my application to catch the Esc key
but it seems to work randomly and to be eventually quite useless: if a .NET
control has the focus, the form receive the Key event first as excpected but
if an ActiveX control has the focus (such as the web browser activex), the
form sometimes never receives key events. Nothing in the doc about that.
Very disapointing.
Nov 16 '05 #3
Thank you, I will have a look.

Patrick.

"Benny Mathew" <be************@yahoo.com> wrote in message
news:em****************@TK2MSFTNGP10.phx.gbl...
Hi
check this link for sample code

http://msdn.microsoft.com/library/de...eviewTopic.asp
-Benny

Patrick de Ridder wrote:
"Forms provide a Boolean KeyPreview property. If you set this to true, your form receives key press events when any of its controls have focus, and it receives these events before the control does. This technique is useful if you are programming a customized interface or a game where you need to take complete control of the keyboard."

Could someone please explain with a simple example. I tried, but couldn't.
Many thanks.

Nov 16 '05 #4

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

Similar topics

0
1009
by: Chuck | last post by:
I have KeyPreview set to true for my form. How do I ucase all of my keyboard input at this level?
1
6149
by: Rene | last post by:
Hi, I am running is some problems with the KeyPreview and KeyPress events. The KeyPress event is only triggered when there this an focusable control on the form. When all controls are disabled...
3
2341
by: Vadim Rapp | last post by:
Hi: On my form, I have textbox and combo box. Form's KeyPreview = True. It does work for the textbox, but not for the combo. I.e. Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As...
13
3823
by: HABJAN ®iga | last post by:
I'am using form's keypreview property & keydown (on form) to look for hotkeys (alt+?) Everything works fine, except when i have focus on combobox. Then the event on form isn't raised. Can...
9
8266
by: Charles Law | last post by:
I have asked a similar question to this before, but have not found a satisfactory answer yet, so I thought I would ask it in another way. KeyPreview, for a form, handily allows keys to be...
2
1598
by: RvGrah | last post by:
I have always found the form-level KeyPreview feature near useless, as there was a bug that allowed ComboBoxes to ignore it. In VS 2005 I've confirmed that it now woks in Combos. Is there anything...
1
6002
by: Ryan Liu | last post by:
Hi, I know Form has a KeyPreview property, is there a similar property that can be used to control mouse event that is only processed at the from level, not the controls on it? I am asking...
2
2094
by: bakpao | last post by:
I want to have a form that accepts keypresses. The controls other than the form should not receive any of the user input. I have implemented it using IMessageFilter but now just now I discovered...
1
2491
by: dragonjim | last post by:
In vb.net, if I want to detect a keypress, I must first set keypreview to true on the form. In VB6, it was pretty simple, but in vb.net, I can't find where keypreview gets set. How do I do it?
0
7076
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6984
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
7453
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5576
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,...
1
5005
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4670
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1507
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
732
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.