Create proper Ctrl+Backspace shortcut in TextBox
See original GitHub issueIn Windows, Ctrl+Backspace commonly serves as a shortcut to delete the word immediately preceding the cursor. It is equivalent to Ctrl+Shift+Left followed by Backspace.
In WinForms, this shortcut works only in single-line TextBox controls which have autocomplete enabled. This is actually built into SHAutoComplete somewhere in the win32 API, and is a “rogue feature” with no documentation (some history here). If the TextBox is multi-line or doesn’t have autocomplete on, Ctrl+Backspace inserts a DELETE character (ASCII 127) instead.
Note: The Ctrl+Delete shortcut (which deletes the word following the cursor) works in all relevant WinForms controls.
Outside of WinForms, the Ctrl+Backspace shortcut is nearly ubiquitous on Windows (as of October 2018, even Notepad finally has it!). As such, I propose properly implementing it in WinForms controls such as TextBoxBase and ComboBox with a custom handler for Ctrl+Backspace.
I’ve submitted a PR with one approach to add this shortcut, namely using sending native messages to simulate the aforementioned SendInputCtrl+Shift+Left, Backspace keystrokes. I believe this is the right approach — as even the current autocomplete TextBox “feature” seems to be selecting the text and then deleting it if you watch closely.
Another possibility would be to use internal text selection functions rather than sending keystrokes. However, that requires replicating the logic dealing with word boundaries/punctuation currently used by Ctrl+Shift+Left, which is a bit quirky, not to mention wildly inconsistent between different Windows programs. We can consider this approach if the current PR is lacking.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:9
- Comments:15 (12 by maintainers)

Top Related StackOverflow Question
@zsd4yr WinForms has a custom “select all” shortcut handler for multi-line
TextBoxcontrols here with a comment explicitly calling out the intent to support something that the native control doesn’t.I live by Ctrl+Back/Del/Left/Right. It doesn’t have the awareness of users and implementors that it should have for how much it improves quality of keyboard usage.