Files
docs-desktop/dotnet-desktop-guide/framework/winforms/how-to-modify-keyboard-input-to-a-standard-control.md
T
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

5.4 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Modify Keyboard Input to a Standard Control 03/30/2017
csharp
vb
keyboard input [Windows Forms], modifying
modifying keyboard input
Windows Forms, modifying keyboard input
keyboards [Windows Forms], keyboard input
626d3712-d866-4988-bcda-a2d5b36ec0ba

How to: Modify Keyboard Input to a Standard Control

Windows Forms provides the ability to consume and modify keyboard input. Consuming a key refers to handling a key within a method or event handler so that other methods and events further down the message queue do not receive the key value. Modifying a key refers to modifying the value of a key so that methods and event handlers further down the message queue receive a different key value. This topic shows how to accomplish these tasks.

To consume a key

To modify a standard character key

To modify a noncharacter key

Example

The following code example is the complete application for the code examples in the previous sections. The application uses a custom control derived from the xref:System.Windows.Forms.TextBox class to consume and modify keyboard input.

[!code-csharpSystem.Windows.Forms.KeyBoardInput#0] [!code-vbSystem.Windows.Forms.KeyBoardInput#0]

Compiling the Code

This example requires:

  • References to the System, System.Drawing and System.Windows.Forms assemblies.

See also