I found an article here:
Winforms Textbox – Using Ctrl-Backspace to Delete Whole Word
to delete the whole word in a textbox while holding ctrl+backspace, but I noticed that if you don’t implement the app.config modifications like so:
<configuration>
<appSettings>
<add key="SendKeys" value="SendInput" />
</appSettings>
</configuration>
that only the current word will be removed and the process of backspacing will be interrupted. For instance, if I typed in “Tim tom” and then used the ctrl + backspace trick, “tom” would be deleted, interrupting any backspace operation and leaving “Tom “.
If you do use the app.config modification, however, “tom” would successfully be removed and backspace operations would continue, but without continuing to remove whole words, as if you were just holding the backspace button.
Does anyone know what causes this or how to fix it?
Your application is choosing a different behavior of sending keypress equivalents to the application.
The historical exposition why the two protocols exist is explained here:
The timing issues mentioned here concern especially continued control of application by characters, not just one character at a time. They include
However, the real reason between the
SendKeysbehavior change was not programmer friendliness (which did not improve significantly), but security.It is definitely a good idea to set the
SendKeysparameter to specify the desired behavior. You don’t want your application to mysteriously start behaving differently just because UAC was turned on or off.