Document KeyPreview exceptions and keyboard interception guidance for WinForms#2254
Open
adegeo wants to merge 7 commits into
Open
Document KeyPreview exceptions and keyboard interception guidance for WinForms#2254adegeo wants to merge 7 commits into
adegeo wants to merge 7 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Windows Forms keyboard input docs to better explain why KeyPreview doesn’t catch some keys (notably keys handled during preprocessing), and it refreshes related snippets and references.
Changes:
- Added a new “When
KeyPreviewis not enough” section that explains preprocessing exceptions and shows aProcessCmdKeyoverride example. - Added a quick decision guide and a form-level limitations note to the keyboard input overview.
- Updated snippets (readability improvements,
SendKeyssequences), plus fixed a WinForms/WPF type reference and refreshed dates.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet-desktop-guide/winforms/input-keyboard/validation.md | Fixes an incorrect WPF TextBox reference to the WinForms TextBox, and updates ms.date. |
| dotnet-desktop-guide/winforms/input-keyboard/overview.md | Adds a keyboard interception decision table, clarifies form-level limitations, and fixes a punctuation artifact. |
| dotnet-desktop-guide/winforms/input-keyboard/how-to-simulate-events.md | Adds a caution about locale-sensitive window title lookup. |
| dotnet-desktop-guide/winforms/input-keyboard/how-to-handle-forms.md | Adds a section explaining preprocessing exceptions and links to ProcessCmdKey examples. |
| dotnet-desktop-guide/winforms/input-keyboard/snippets/how-to-simulate-events/vb/projectvb.vbproj | Updates snippet project TFM to net10.0-windows. |
| dotnet-desktop-guide/winforms/input-keyboard/snippets/how-to-simulate-events/vb/Form1.vb | Updates SendKeys sequence to match the intended shortcut. |
| dotnet-desktop-guide/winforms/input-keyboard/snippets/how-to-simulate-events/csharp/project.csproj | Updates snippet project TFM to net10.0-windows. |
| dotnet-desktop-guide/winforms/input-keyboard/snippets/how-to-simulate-events/csharp/Form1.cs | Updates SendKeys sequence to match the intended shortcut. |
| dotnet-desktop-guide/winforms/input-keyboard/snippets/how-to-handle-forms/vb/projectvb.vbproj | Updates snippet project TFM to net10.0-windows. |
| dotnet-desktop-guide/winforms/input-keyboard/snippets/how-to-handle-forms/vb/Form1.vb | Improves digit detection/readability, and adds a ProcessCmdKey override snippet. |
| dotnet-desktop-guide/winforms/input-keyboard/snippets/how-to-handle-forms/csharp/project.csproj | Updates snippet project TFM to net10.0-windows. |
| dotnet-desktop-guide/winforms/input-keyboard/snippets/how-to-handle-forms/csharp/Form1.cs | Improves digit detection/readability, and adds a ProcessCmdKey override snippet. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
gewarren
approved these changes
Jul 2, 2026
Contributor
There was a problem hiding this comment.
Replace %2A with * in this file.
Contributor
There was a problem hiding this comment.
Replace %2A with * in this file.
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
…sktop into winforms/2235/keyboard
gewarren
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2235
KeyPreviewis not enough" section tohow-to-handle-forms.mdcovering preprocessing exceptions and aProcessCmdKeyoverride example.overview.mdfor choosing the right keyboard interception API.overview.mdwith a cross-link to the new exceptions section.overview.mdpreprocessing table.validation.md.SendKeysexample inhow-to-simulate-events.md.how-to-handle-formssnippets to use readable character literals instead of numeric char codes.Internal previews