Search code examples
c#keypresssendkeys

How to simulate key presses in C#


How would you go about sending key commands or keypresses of particular keys in C#, specifically numbers.

For instance I would like to simulate typing "512" programatically.

Possibly Related: C# SendKeys.Send


Solution

  • If you would use inputsimulator you could just do:

       var number = 2011;
       InputSimulator.SimulateTextEntry(number.ToString());