Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
Advertisements