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. Shortcut Keys on Forms

Shortcut Keys on Forms

Scheduled Pinned Locked Moved C#
csharpvisual-studioquestion
3 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.
  • P Offline
    P Offline
    paas
    wrote on last edited by
    #1

    I'm developing Windows Applications under Visual Studio 2005. I've noticed that when radio buttons, check boxes or command buttons have the focus on a form, all I need to do is press the letter assigned as a shortcut key for another control for that other control to receive the focus. I really do not want that behavior, I want the user to always have to press Alt-letter for a control with a shortcut key to get the focus (when a text box has the focus, the user does have to press Alt-letter for focus to change to another control). Can anyone tell me what I need to do to ensure that the user has to press Alt-letter to set focus to a new control when a radio button, check box or command button has the focus? Thank you...

    S 1 Reply Last reply
    0
    • P paas

      I'm developing Windows Applications under Visual Studio 2005. I've noticed that when radio buttons, check boxes or command buttons have the focus on a form, all I need to do is press the letter assigned as a shortcut key for another control for that other control to receive the focus. I really do not want that behavior, I want the user to always have to press Alt-letter for a control with a shortcut key to get the focus (when a text box has the focus, the user does have to press Alt-letter for focus to change to another control). Can anyone tell me what I need to do to ensure that the user has to press Alt-letter to set focus to a new control when a radio button, check box or command button has the focus? Thank you...

      S Offline
      S Offline
      saqib82
      wrote on last edited by
      #2

      use the & sign for the letter (in the text of that control) you want to use as a shortcut, and it will work with the Alt key. e.g btn1.Text = "&button" so the shortcut for btn1 will be 'Alt+b' regards

      sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

      P 1 Reply Last reply
      0
      • S saqib82

        use the & sign for the letter (in the text of that control) you want to use as a shortcut, and it will work with the Alt key. e.g btn1.Text = "&button" so the shortcut for btn1 will be 'Alt+b' regards

        sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

        P Offline
        P Offline
        paas
        wrote on last edited by
        #3

        I'm afraid I either posted my original question very poorly, or you misunderstood. I know how to create a shortcut key, my problem is that when a control other than a text box control has the focus, the user does not have to press the Alt key to go to another control that has a shortcut (or accelerator) key. For example, assume the command buttons below where btn1 has the shortcut set to "b", and btn2 has the shortcut set to "u" btn1.Text = "&button1" btn2.Text = "b&utton2" If btn2 currently has the focus, the user only has to press the letter "b" for btn1 to get the focus. I would prefer if the user always had to press the "Alt" key before any shortcut is activated but as long as the focus is not on a textbox, the "Alt" keys is apparently now unnecessary. I know I can tackle this issue by ensuring the Alt key is pressed in the KeyDown event of non-textbox controls, but I'm hoping there is some global setting in Tools-Options that I do not know about that will quickly tackle this issue for any apps I may develop. Thank you...

        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