473,385 Members | 1,409 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,385 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 4065
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.