
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
Check if Caps Lock and Num Lock is on or off through Console in C#
To check if Caps Lock is on or off through Console, the code is as follows −
Example
using System; public class Demo{ public static void Main(string[] args){ Console.WriteLine("The CAPS LOCK is on or not? "+ Console.CapsLock); } }
Output
This will produce the following output −
The CAPS LOCK is on or not? False
Example
To check if Num Lock is on or off through Console, the code is as follows −
using System; public class Demo{ public static void Main(string[] args){ Console.WriteLine("The Num LOCK is on or not? "+ Console.NumberLock); } }
Output
This will produce the following output −
The Num LOCK is on or not? True
- Related Articles
- How to Detect if CAPS Lock is ON using JavaScript?
- How to show the status of CAPS Lock Key in tkinter?
- Check if Input, Output and Error is redirected on the Console or not in C#
- Difference between Object level lock and Class level lock in Java
- Use ReaderWriter Lock in C#
- Object level lock vs Class level lock in Java?
- What is the difference between Monitor and Lock in C#?
- An alternative invisible lock screen on android
- Transaction lock in MongoDB?
- Reetrant Lock in Java
- Lock Variable Mechanism
- How to debug Lock wait timeout exceeded on MySQL?
- How to Lock Your Hard Drive on Windows OS?
- How does a Lock work?
- How to lock screen orientation on all android devices programmatically?

Advertisements