Whats the KeyCode for overwriting a text in TextBox in winforms

Posted by Ragha J on Stack Overflow See other posts from Stack Overflow or by Ragha J
Published on 2010-04-21T23:29:14Z Indexed on 2010/04/21 23:33 UTC
Read the original article Hit count: 483

Filed under:
|
|
|

I have a custom control which extends from TextBox. In the KeyDown event of the control I have access to the KeyCode property of keyEventArgs

If the text in the textbox is selected and some other text is typed on top of it, the keyCodes that I am getting in the KeyDown event are different each time and in the KeyPress event I get the actual value.

For ex: If the textbox has value 1234 and now I select 1234 and type 5 on top of it, I want to to be able to know in any of the events by some key combination that the old value 1234 is gone and the new value of the textbox is 5.

© Stack Overflow or respective owner

Related posts about winforms

Related posts about keycode