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. How to give keyboard shortcut to Command Button

How to give keyboard shortcut to Command Button

Scheduled Pinned Locked Moved C#
tutorialquestion
3 Posts 3 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.
  • A Offline
    A Offline
    Aslam Bari
    wrote on last edited by
    #1

    Dear all, I am trying to find the easiest way to give a keyboard shortcut to a command button like CTRL+K or F9 etc. Can i also give the shortcut key to ToolStripButton? How? Thanks...

    C N 2 Replies Last reply
    0
    • A Aslam Bari

      Dear all, I am trying to find the easiest way to give a keyboard shortcut to a command button like CTRL+K or F9 etc. Can i also give the shortcut key to ToolStripButton? How? Thanks...

      C Offline
      C Offline
      Coding C
      wrote on last edited by
      #2

      Hi, i dont think there is a direct way to assign CTRL combination to command button. but you can always use the ALT+ combination by just typing the "&" before the character in the button text property. if you anyway want to give CTRL combination or F9 like shortcut key you can use the form keydown event and check for the key combination pressed and raise the button_click event manually. Hope this works. Nitin...

      1 Reply Last reply
      0
      • A Aslam Bari

        Dear all, I am trying to find the easiest way to give a keyboard shortcut to a command button like CTRL+K or F9 etc. Can i also give the shortcut key to ToolStripButton? How? Thanks...

        N Offline
        N Offline
        Nader Elshehabi
        wrote on last edited by
        #3

        Hello Handle the KeyUp event in all possible control that would receive this combination. you can point them all to one event handler BTW. Then in that event handler check for the combination. If true call MyToolStripButton.PerformClick() method, or use a common method to do the job.

        Regards:rose:

        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