Click here to Skip to main content
15,040,212 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I have a one problem for backspaces in c#(windows)

I have written following code in keyup event for textbox i.e (Text Box is placed On 5 th panel)

if(e.keydata==keys.back)

   {
   sendkeys.send=("+{BS}");
   Sendkeys.send={Break};
   }


It will delete ONLY ONE char. When I'm pressing backspace button but when I'm holding backspace button it will not delete the complete chars. Just it will deldete one char for one pressing. Could you please give me the solution.
[edit]Code block, capitalization - OriginalGriff[/edit]
Posted
Updated 25-Mar-11 6:13am
v2

1 solution

When do you think you get the KeyUp event?

I'll give you a clue:

Push a key down - you get a KeyDown event.

Hold it down - you get KeyDown (and sometimes KeyPress) events

Let go of a key - what event do you get?

What you want to do is handle the Key Down or KeyPress event instead...
   
Comments
wizardzz 25-Mar-11 13:42pm
   
+5 I was about to answer the same way, I don't know who gave you the 4.
Sergey Alexandrovich Kryukov 25-Mar-11 13:56pm
   
Easy enough, a 5.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900