473,748 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4108
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 KeyPressEventAr gs.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 KeyPressEventAr gs.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
344
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 my C# application. I saw a tech note and a hot fix for this problem for .NET 1.0.. but i'm using ..NET 1.1 (Visual Studio 2003). Did this problem re-surface?
1
5496
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 return upper case letter. Is there any configuration so that I can capture the correct letter case? Also in Vb I can change KeyAscii to another value. How can I do that in C#? Regards,
1
1490
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
3281
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 appreciated. Thanks, Trint
4
7130
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 System.Windows.Forms.KeyEventArgs) _ Handles ListBox1.KeyUp, ListBox1.KeyDown If e.KeyValue = Keys.PageDown Or e.KeyValue = Keys.PageUp Or e.KeyValue = Keys.End Or e.KeyValue = Keys.Home Then
6
14213
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 get keycode vs event types. http://www.w3.org/2002/09/tests/keys-cancel2.html
3
7887
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 seem to be losing information when Casting to char, since I never have any problem using special keys if I use something like e.KeyCode == Keys.Delete But . . there is no Keys.Astericks (or Star or similar)
7
1817
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 the form does not triggered. Can anyone help me? Thanks a lot.
4
5653
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 Binary_Serialization Dim FlagFormKeyDown As Boolean = False Dim uicounter1 As UInt16 = 0 Dim uicounter2 As UInt16 = 0
0
8984
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9363
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9238
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8237
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4593
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3300
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 we have to send another system
2
2775
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.