Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Using CAPSLOCK status in StatusBarPanel

Using CAPSLOCK status in StatusBarPanel

Scheduled Pinned Locked Moved C#
csharpquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sgg245
    wrote on last edited by
    #1

    I m using a status bar in the form. In one of the panels of the status bar, I just want set the status of the CAPSLOCK & NUMLOCK, the same way it can be done in VB. But in VB the panel properties has different display value, so it was easy. How this can be achieved in C#???:confused: Thanks in advance...:)

    Regards SG (sgg245@yahoo.co.in)

    L 1 Reply Last reply
    0
    • S Sgg245

      I m using a status bar in the form. In one of the panels of the status bar, I just want set the status of the CAPSLOCK & NUMLOCK, the same way it can be done in VB. But in VB the panel properties has different display value, so it was easy. How this can be achieved in C#???:confused: Thanks in advance...:)

      Regards SG (sgg245@yahoo.co.in)

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      The properties Console.CapsLock and Console.NumberLock provide the necessary information. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


      S 1 Reply Last reply
      0
      • L Luc Pattyn

        The properties Console.CapsLock and Console.NumberLock provide the necessary information. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


        S Offline
        S Offline
        Sgg245
        wrote on last edited by
        #3

        Thanks so much. Its working. But stil a prob. This is when the application start it detects if the CAPSLOCK is ON then I can display certain msg or so... But I want whenever CAPSLOCK button is pressed then it should update the status of the panel in the status bar. If CAPSLOCK is ON then status bar panel should show ON. If CAPSLOCK is toggled i.e. OFF then status bar panel should show OFF. Something like this... Thanks in Advance...;):);)

        Regards SG (sgg245@yahoo.co.in)

        L 1 Reply Last reply
        0
        • S Sgg245

          Thanks so much. Its working. But stil a prob. This is when the application start it detects if the CAPSLOCK is ON then I can display certain msg or so... But I want whenever CAPSLOCK button is pressed then it should update the status of the panel in the status bar. If CAPSLOCK is ON then status bar panel should show ON. If CAPSLOCK is toggled i.e. OFF then status bar panel should show OFF. Something like this... Thanks in Advance...;):);)

          Regards SG (sgg245@yahoo.co.in)

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Hi, there are at least two ways to keep your status bar up-to-date: 1. on your form, set KeyPreview true; then add an event handler for KeyDown; the handler now will fire for every key moving down; in the handler check for Keys.CapsLock; if it is, use Keyboard.CapsLock and update the status bar; don't try to count the toggles yourself ! 2. on your form, add a Windows.Forms.Timer and let it fire say every second; in its Tick handler read Keyboard.CapsLock and update status bar. The choice is yours, it depends a bit on which of those handlers you may already have for some other reason. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


          S 1 Reply Last reply
          0
          • L Luc Pattyn

            Hi, there are at least two ways to keep your status bar up-to-date: 1. on your form, set KeyPreview true; then add an event handler for KeyDown; the handler now will fire for every key moving down; in the handler check for Keys.CapsLock; if it is, use Keyboard.CapsLock and update the status bar; don't try to count the toggles yourself ! 2. on your form, add a Windows.Forms.Timer and let it fire say every second; in its Tick handler read Keyboard.CapsLock and update status bar. The choice is yours, it depends a bit on which of those handlers you may already have for some other reason. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


            S Offline
            S Offline
            Sgg245
            wrote on last edited by
            #5

            Thanks very much. I anticipated something like we used to do in VB status bar panels... Anyways, again thanks for ur help... so kind of u...:-D

            Regards SG (sgg245@yahoo.co.in)

            L 1 Reply Last reply
            0
            • S Sgg245

              Thanks very much. I anticipated something like we used to do in VB status bar panels... Anyways, again thanks for ur help... so kind of u...:-D

              Regards SG (sgg245@yahoo.co.in)

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              You're welcome. Come to think of it, I would prefer the timer approach; with key events, if your app looses focus, capslock gets toggles, app gets focus back, you will not know about the change (unless you add code to some other events too, such as Activate). :)

              Luc Pattyn [Forum Guidelines] [My Articles]


              this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups