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 problem 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. ✌
- Home
 - Tutorial Bahasa Indonesia
 - _Visual Basic 6 (VB6)
 - __VB6 Basic & General
 - __VB6 MySQL
 - _Visual Basic .NET
 - __VB.NET Basic & General
 - __VB.NET Ms Access
 - __VB.NET MySQL
 - __VB.NET Printing
 - _ASP.NET
 - _C#
 - _PHP
 - _Flutter
 - _MySQL
 - _SQL Server
 - _SQL Reporting (SSRS)
 - English Tutorial
 - Youtube Channel
 - About Me
 - _About Me and This Blog
 - _Stories Of Life
 - _Portofolio
 

0 Comments