If a text box control is in focus the default functionality of Key.Up and Key.Down are to move the cursor right and left respectively within the text box. I am interested in overriding this functionality. In my application a text box is used for inputs which I would like to remember. I would like for the user to be able to press up or down to populate the text box with their last input (or next input if they had gone back already).

To do this I have tried subscribing to the KeyPress event and checking the event arguments for Key.Up and Key.Down. However, this event never seems to get triggered when I use these keys. My thought is that it's being handled somewhere else, perhaps on a form level.

If anybody could point me in the right direction I would be very grateful.

Thanks in advance. :)

8 Years
Discussion Span
Last Post by LizR

try the keydown you have far more control then

Indeed, when I use KeyDown it allows me to hook into when the user presses Up or Down, but the default functionality (cursor moving) is still there. How can I suppress that functionality?


Ah.. Take a look at the other options under keydown.. theres one just what you're looking for

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.