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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How can i set shortcut of a Button press event?

How can i set shortcut of a Button press event?

Scheduled Pinned Locked Moved C#
questionhelp
9 Posts 5 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.
  • D Offline
    D Offline
    dipak dipak
    wrote on last edited by
    #1

    Hello everybody, I want to set a shortcut for a button, Such as for "Show" Button, i want to set the shortcut Alt+S. (For both Windows Application an Web Application) Please help me.. Thank you! :-O Best of Luck.

    Dipak

    A V C D 4 Replies Last reply
    0
    • D dipak dipak

      Hello everybody, I want to set a shortcut for a button, Such as for "Show" Button, i want to set the shortcut Alt+S. (For both Windows Application an Web Application) Please help me.. Thank you! :-O Best of Luck.

      Dipak

      A Offline
      A Offline
      Ajay k_Singh
      wrote on last edited by
      #2

      I have no idea about web application; however in a WinForm application it should be as simple as setting Text property of button to “&Show”. This will allow you to use ‘Alt+S’ to fire click event of ‘Show’ button. -Dave.

      Dave Traister, ComponentOne LLC. www.componentone.com

      D 1 Reply Last reply
      0
      • A Ajay k_Singh

        I have no idea about web application; however in a WinForm application it should be as simple as setting Text property of button to “&Show”. This will allow you to use ‘Alt+S’ to fire click event of ‘Show’ button. -Dave.

        Dave Traister, ComponentOne LLC. www.componentone.com

        D Offline
        D Offline
        dipak dipak
        wrote on last edited by
        #3

        Thank you for Reply. Ok It may be a process, but i want to set any shortcut like Ctrl+s, Ctrl+Shift+s,Alt+Shift+s, F1, or any other combination. If anyone have any idea about this, Please reply me. Thank you once again.

        Dipak

        V S 2 Replies Last reply
        0
        • D dipak dipak

          Thank you for Reply. Ok It may be a process, but i want to set any shortcut like Ctrl+s, Ctrl+Shift+s,Alt+Shift+s, F1, or any other combination. If anyone have any idea about this, Please reply me. Thank you once again.

          Dipak

          V Offline
          V Offline
          Vasudevan Deepak Kumar
          wrote on last edited by
          #4

          dipak.dipak wrote:

          Ctrl+s, Ctrl+Shift+s,Alt+Shift+s, F1

          For Web Applications, you may then need to handle the onKeyDown event handlers yourself in JavaScript.

          Vasudevan Deepak Kumar Personal Homepage
          Tech Gossips
          A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

          1 Reply Last reply
          0
          • D dipak dipak

            Hello everybody, I want to set a shortcut for a button, Such as for "Show" Button, i want to set the shortcut Alt+S. (For both Windows Application an Web Application) Please help me.. Thank you! :-O Best of Luck.

            Dipak

            V Offline
            V Offline
            Vasudevan Deepak Kumar
            wrote on last edited by
            #5

            dipak.dipak wrote:

            Web Application

            AccessKey Attribute www.htmlcodetutorial.com/linking/_A_ACCESSKEY.html[^]

            Vasudevan Deepak Kumar Personal Homepage
            Tech Gossips
            A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

            1 Reply Last reply
            0
            • D dipak dipak

              Thank you for Reply. Ok It may be a process, but i want to set any shortcut like Ctrl+s, Ctrl+Shift+s,Alt+Shift+s, F1, or any other combination. If anyone have any idea about this, Please reply me. Thank you once again.

              Dipak

              S Offline
              S Offline
              stofel
              wrote on last edited by
              #6

              Hi, as far as I know, you have to program i manualy. So build up a list of buttons and the combination of keypresses, theu should react on. And look at ProcessCmdKey in your form, figure out, whicht key is pressed on the form and fire the right button.PerformClick(). Happy coding Willibert

              1 Reply Last reply
              0
              • D dipak dipak

                Hello everybody, I want to set a shortcut for a button, Such as for "Show" Button, i want to set the shortcut Alt+S. (For both Windows Application an Web Application) Please help me.. Thank you! :-O Best of Luck.

                Dipak

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #7

                In a web app, you need to handle keypress events and write the code to do whatever you want. In javascript.

                Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                1 Reply Last reply
                0
                • D dipak dipak

                  Hello everybody, I want to set a shortcut for a button, Such as for "Show" Button, i want to set the shortcut Alt+S. (For both Windows Application an Web Application) Please help me.. Thank you! :-O Best of Luck.

                  Dipak

                  D Offline
                  D Offline
                  dipak dipak
                  wrote on last edited by
                  #8

                  Various Windows application uses Shortcuts Keys. How they implemented? For example Cyberlink PowerDVD : Please see it. here u will find numerous shortcuts. I want like this. Please help me. :-O Thank You.

                  Dipak

                  A 1 Reply Last reply
                  0
                  • D dipak dipak

                    Various Windows application uses Shortcuts Keys. How they implemented? For example Cyberlink PowerDVD : Please see it. here u will find numerous shortcuts. I want like this. Please help me. :-O Thank You.

                    Dipak

                    A Offline
                    A Offline
                    Ajay k_Singh
                    wrote on last edited by
                    #9

                    Hello, Willibert has already answered your question in a very nice way. However if you do not want to use ProcessCmdKey, in that case you may simply set KeyPreview property of Form to true and then use KeyPress event of Form to trap keys, and call any method as per need. -Dave.

                    Dave Traister, ComponentOne LLC. www.componentone.com

                    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