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