VB.net check if CAPS LOCK is on

Place this code Within your public class, if you have a password box then it will let the user know if CAPS is in the on or off state:

Private Declare Sub keybd_event Lib “user32″ (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)

Code to toggle CAPS LOCK state

‘Turn on CAPS
Call keybd_event(System.Windows.Forms.Keys.CapsLock, &H14, 1, 0)

‘Turn Off CAPS
Call keybd_event(System.Windows.Forms.Keys.CapsLock, &H14, 3, 0)

Leave a comment

You must be logged in to post a comment.