Permalink
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (34 sloc) 2.45 KB
title ms.custom ms.date ms.prod ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
How to: Handle User Input Events in Windows Forms Controls
03/30/2017
.net-framework
dotnet-winforms
article
jsharp
Windows Forms controls, user input
user input, Windows Forms controls
3de74dcf-fae3-42d0-92b5-bc04a61a6888
9
dotnet-bot
dotnetcontent
wpickett

How to: Handle User Input Events in Windows Forms Controls

This example demonstrates how to handle most keyboard, mouse, focus, and validation events that can occur in a Windows Forms control. The text box named TextBoxInput receives the events when it has focus, and information about each event is written in the text box named TextBoxOutput in the order in which the events are raised. The application also includes a set of check boxes that can be used to filter which events to report.

Example

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

Compiling the Code

This example requires:

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

For information about building this example from the command line for [!INCLUDEvbprvb] or [!INCLUDEcsprcs], see Building from the Command Line or Command-line Building With csc.exe. You can also build this example in [!INCLUDEvsprvs] by pasting the code into a new project. Also see How to: Compile and Run a Complete Windows Forms Code Example Using Visual Studio.

See Also

User Input in Windows Forms