+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Check Caps Lock and Num Lock

  1. #11
    cismarel is offline Learning Programmer
    Join Date
    May 2009
    Location
    Romania
    Posts
    37
    Rep Power
    0

    Smile Re: Check Caps Lock and Num Lock

    But if i want check the caps and num lock in a windows form application?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #12
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: Check Caps Lock and Num Lock

    So if thats the code.. it is possible to change the value?

    Code:
    Console.CapsLock = false;
    is this value a copy of the value or does it really change if caps lock is on?

  4. #13
    arslan220 Guest

    Re: Check Caps Lock and Num Lock

    hi thanks for sharing.

  5. #14
    Parabola's Avatar
    Parabola is offline Programming Professional
    Join Date
    Jul 2009
    Location
    Texas
    Posts
    336
    Blog Entries
    4
    Rep Power
    13

    Re: Check Caps Lock and Num Lock

    Quote Originally Posted by BlaineSch View Post
    So if thats the code.. it is possible to change the value?

    Code:
    Console.CapsLock = false;
    is this value a copy of the value or does it really change if caps lock is on?
    Quick Answer: Can't edit.
    Long Answer provided by the compiler itself:
    Property or indexer 'System.Console.CapsLock' cannot be assigned to -- it is read only

  6. #15
    rahuljin is offline Newbie
    Join Date
    Aug 2009
    Posts
    3
    Rep Power
    0

    Re: Check Caps Lock and Num Lock

    Quote Originally Posted by cismarel View Post
    But if i want check the caps and num lock in a windows form application?
    i have the same question.

  7. #16
    Parabola's Avatar
    Parabola is offline Programming Professional
    Join Date
    Jul 2009
    Location
    Texas
    Posts
    336
    Blog Entries
    4
    Rep Power
    13

    Re: Check Caps Lock and Num Lock

    Quote Originally Posted by rahuljin View Post
    i have the same question.
    For those who want to use this in a windows form, Here's an example of how:

    Code:
    MessageBox.Show(Control.IsKeyLocked(Keys.CapsLock).ToString());
    Basically, Control.IsKeyLocked(Keys.Capslock) return a true or false.
    Correct syntax is such:
    Code:
    public static bool IsKeyLocked(
        Keys keyVal
    )
    keyVal being the key you want checked

    The way I used it:
    Code:
    Control.IsKeyLocked(Keys.<key>);
    Programmer (n): An organism that can turn caffeine into code.
    Programming would be so much easier without all the users.

  8. #17
    gokuajmes's Avatar
    gokuajmes is offline Programming God
    Join Date
    Jan 2010
    Location
    India
    Posts
    516
    Blog Entries
    5
    Rep Power
    12

    Re: Check Caps Lock and Num Lock

    all are the same,but there are some coding strategies to use to minimize runtime,so i vote for both as they contain the qualities i consider

+ Reply to Thread
Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to lock the keyboard in C#?
    By Gabriel_Munits in forum C# Programming
    Replies: 1
    Last Post: 11-05-2011, 06:58 AM
  2. Controlling caps/num/scoll lock LEDs
    By ThunderGraduate in forum General Programming
    Replies: 2
    Last Post: 11-14-2010, 10:41 PM
  3. lock c++
    By h4x in forum C and C++
    Replies: 5
    Last Post: 09-11-2009, 06:33 AM
  4. lock XP
    By abu_rakan in forum C# Programming
    Replies: 3
    Last Post: 12-30-2008, 08:13 PM
  5. lock and pay system
    By nishbur in forum Software Development Tools
    Replies: 3
    Last Post: 07-01-2008, 12:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts