Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / June 2006

Tip: Looking for answers? Try searching our database.

KeyPress concept?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
wikoh - 25 Jun 2006 21:30 GMT
In old Visual Basic there was a KeyPress event that happened when a key was
released some max time after it was pushed. I guess this was to allow a press
to be cancelled if held down for a while (like holding down a button) Is
there any such system-defined time between keydown and keyup that makes a
KeyPress, that I can use through .NET?
Nat - 26 Jun 2006 12:54 GMT
Hello wikoh,

There is in fact KeyPress event as well.

http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.keypress.aspx

> In old Visual Basic there was a KeyPress event that happened when a
> key was released some max time after it was pushed. I guess this was
> to allow a press to be cancelled if held down for a while (like
> holding down a button) Is there any such system-defined time between
> keydown and keyup that makes a KeyPress, that I can use through .NET?
Stoitcho Goutsev (100) - 26 Jun 2006 15:33 GMT
wikoh,

I don't know what exactly KeyPress does in VB6, but windows forms controls
fire three key events. One of them I think may help you with what you need.

Look at the windows forms Control class in MSDN. There are KeyDown, KeyUp,
KeyPress - they all have Handled property that can be used to cancel the
default processing of the event.

Signature

HTH
Stoitcho Goutsev (100)

> In old Visual Basic there was a KeyPress event that happened when a key
> was
[quoted text clipped - 3 lines]
> there any such system-defined time between keydown and keyup that makes a
> KeyPress, that I can use through .NET?
Mini-Tools Timm - 27 Jun 2006 15:01 GMT
> In old Visual Basic there was a KeyPress event that happened when a key was
> released some max time after it was pushed. I guess this was to allow a press
> to be cancelled if held down for a while (like holding down a button) Is
> there any such system-defined time between keydown and keyup that makes a
> KeyPress, that I can use through .NET?

Unfortunately there is no key event whcih occurs after a certain time.  All
.NET key events fire in response to the user pressing or releasing a key.

There are three key events which occur in the following order:

1. KeyDown
2. KeyPress
3. KeyUp

The KeyPress event is raised only by character keys (e.g., not by the Shift
or F1 keys, etc.)  The KeyPress event fires immediately after the KeyDown
event.  Of course, the KeyUp event fires once the user releases the key.

Hence, to fire an event after a certain amount of time after a key has been
pressed, you will need to create a timer, and start the timer after the
KeyDown event has been pressed.

Signature

Timm Martin
Mini-Tools
.NET Components and Windows Software
http://www.mini-tools.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.