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
Vb.Net: Check If Alt Keyboard Button Is Pressed
Diterbitkan Juli 30, 2020
Artikel Terkait
- Hi There, It's me again. Continue from this article: we.com/search?q=vbnet-introducing-p
- Device and Printer as below picture. Choose any printer you want then right click on its
- Printing. Okay, lets see how it works. Add a button and a printdocument co
- This is a serial panduan of VB.NET and MySQL, So make sure you understand the previous ar
- Is it possible to print an image using PrintDocument Control? Yes, it is. Basic formula
- DisplayStyle --> ImageAndText. This step will change the button style displaying Image a
Langganan:
Posting Komentar (Atom)
EmoticonEmoticon