Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Checking for Num Lock key enabled or not in C#

The Console.NumberLock property, like the Console.CapsLock property, provides a way to determine if a keyboard key is pressed.

  1. using System;
  2. using System.Threading;
  3.  
  4. namespace forgetCode
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. Console.WriteLine(Console.NumberLock);
  11. }
  12.  
  13. }
  14. }


Output:
True or false

..