Link Keyboard Shortcut to Button
-
How do I link a keyboard shortcut to a button on a form? I have added shortcuts to menu items-that is very straightforward-but for some reason, I cannot find information on how to add the shortcut to a button. Thanks.
-
How do I link a keyboard shortcut to a button on a form? I have added shortcuts to menu items-that is very straightforward-but for some reason, I cannot find information on how to add the shortcut to a button. Thanks.
just use Amperion
("&")
before the charecter on which you want to use Keyboard Shortcut.e.g : Button Text="Click" Just Give "&Click"
and on Runtime ->"Alt + C"
will invoked Button Click Methods !!!!cheers, Abhijit Check My Latest Article
-
just use Amperion
("&")
before the charecter on which you want to use Keyboard Shortcut.e.g : Button Text="Click" Just Give "&Click"
and on Runtime ->"Alt + C"
will invoked Button Click Methods !!!!cheers, Abhijit Check My Latest Article
-
How do I link a keyboard shortcut to a button on a form? I have added shortcuts to menu items-that is very straightforward-but for some reason, I cannot find information on how to add the shortcut to a button. Thanks.
Abhijit's answer is correct. if you want to assign function keys, you'll have to set the Form's KeyPreview property to true and handle the Form's KeyPress or KeyDown events and call the PerformClick method (and Focus if you need it) of the button you want pressed.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Expect everything to be hard and then enjoy the things that come easy. (code-frog) -
just use Amperion
("&")
before the charecter on which you want to use Keyboard Shortcut.e.g : Button Text="Click" Just Give "&Click"
and on Runtime ->"Alt + C"
will invoked Button Click Methods !!!!cheers, Abhijit Check My Latest Article
Is there a symbol that can be used for Ctrl + C instead of Alt + C? Thansk.
-
How do I link a keyboard shortcut to a button on a form? I have added shortcuts to menu items-that is very straightforward-but for some reason, I cannot find information on how to add the shortcut to a button. Thanks.
You may want to take a look at this blog post. http://nirandas.com/blog/index.php/ways-to-set-short-cut-keys-for-controls-on-a-windows-forms-net-application/[^] HTH
Nirandas, a developer from India. http://www.nirandas.com