472,370 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

KEYUP ,KEYDOWN EVENT

ZS
Hi,
On a form , I'm trying to trap when a shift key is pressed.
Can someone explain how the KeyUp,KeyDown and Key Press event works for Forms.
Thanks
-ZS
Nov 17 '05 #1
2 3971
To quote an article on MSDN
(http://msdn.microsoft.com/library/de...owntopic.asp):

Key events occur in the following order:
KeyDown
KeyPress
KeyUp

To handle keyboard events only at the form level and not allow other
controls to receive keyboard events, set the KeyPressEventArgs.Handled
property in your form's KeyPress event-handling method to true. Certain keys,
such as the TAB, RETURN, ESCAPE, and arrow keys are handled by controls
automatically. In order to have these keys raise the KeyDown event, you must
override the IsInputKey method in each control on your form. The code for the
override of IsInputKey would need to determine if one of the special keys is
pressed and return a value of true.

Brendan

"ZS" wrote:
Hi,
On a form , I'm trying to trap when a shift key is pressed.
Can someone explain how the KeyUp,KeyDown and Key Press event works for Forms.
Thanks
-ZS

Nov 17 '05 #2
ZS
Hi Brendan,
Thanks for responding. Okay I was able to trap the Key event .
But I want it to be fired only when the mouse is over a particualr control a
pictureBox actually. I'm going to try the Handled Event to see how it can be
trapped.
-Zelma

"Brendan Grant" wrote:
To quote an article on MSDN
(http://msdn.microsoft.com/library/de...owntopic.asp):

Key events occur in the following order:
KeyDown
KeyPress
KeyUp

To handle keyboard events only at the form level and not allow other
controls to receive keyboard events, set the KeyPressEventArgs.Handled
property in your form's KeyPress event-handling method to true. Certain keys,
such as the TAB, RETURN, ESCAPE, and arrow keys are handled by controls
automatically. In order to have these keys raise the KeyDown event, you must
override the IsInputKey method in each control on your form. The code for the
override of IsInputKey would need to determine if one of the special keys is
pressed and return a value of true.

Brendan

"ZS" wrote:
Hi,
On a form , I'm trying to trap when a shift key is pressed.
Can someone explain how the KeyUp,KeyDown and Key Press event works for Forms.
Thanks
-ZS

Nov 17 '05 #3

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

Similar topics

0
by: Todd | last post by:
I am trying to imbed the IE web browser control in my application. I want to sit on the text input fields on the web page and recieve keyup/keydown events. These events are not getting back to...
1
by: kids_pro | last post by:
Hi there, I want to capture the last key press in a textBox. So I decided to use KeyDown event and from the KeyEventArgs I read the e.KeyCode But when I type small letter the e.KeyCode always...
1
by: jayrm100 | last post by:
Hi, Can someone tell me if there is a Keypress,Keyup,keydown or similar events in Mydocument.cs like we have in Actionpane.cs I am using Visual studio 2005(Beta version). Thanks
3
by: trint | last post by:
Ok, I have tried to do this with the System.Web.UI and can't find anything for the webform. It seems much easier for a Winform. Any help in trapping Webform keydown event and keyup event is...
4
by: ShaneO | last post by:
I would like to handle the KeyUp & KeyDown events in the same event handler but can't find how to determine which event was fired - Private Sub ListBox1_KeyUp(ByVal sender As Object, ByVal e As...
6
by: mingchin.AT | last post by:
Hi, In Javascript, the simple way to check user input is to get the keycode. But for cross browser, its seems we need to have two different keycodes for the same key. There is a web page for...
3
by: Luc The Perverse | last post by:
Hey - I am making my first C# form application! (More a teach myself app than any pratical application) I have a listbox that always has the control so I made an event handler for KeyDown. I...
7
by: win | last post by:
I'm convert a VB6 program to .Net platform. My program use function key (F12) to close a form. Now I found that the coding in the keydown event of control triggered, the coding in the keydown of...
4
by: plowgrammer2010 | last post by:
Hi All, I am trying to get Form keydown event in compact framework 3.5 but event is not triggering. I have just one form form1. Public Class Form1 Dim oBinarySave As New...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

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.