I'm making my transaction module can be used by using keyboard only. So I used hotkey Alt + A. I can easily add an "&" (and sign) on a button text just like below image: While I'm pressing Alt + A on the keyboard it will run all codes under button_click event. It works, but when I need to type something else with the keyboard just after that the "Alt" button keeps being pressed. If I want to release the pressed Alt, I should send an Alt pressed. This is how to send Alt key by code: SendKeys .Send( "ALT %" ) I included the above code in button_click event. Another dilema is while I click the button with mouse it still sending Alt Key. So I need to make sure if only when Alt is pressed, we'd send ALT by code. We can use My.Computer.Keyboard.AltKeyDown. And this is how it works: If My .Computer.Keyboard.AltKeyDown Then SendKeys .Send( "ALT %" ) So that's it, good luck and happy coding. ✌ Sumber http://rani-irsan.blogspot.com
pop
Kamis, 30 Juli 2020
Langganan:
Posting Komentar (Atom)
EmoticonEmoticon