Question How to Send Upper Case letters using SendKeys

junk18993

New member
Joined
Jan 27, 2015
Messages
3
Programming Experience
10+
After Googling and reading some stuff I still can't figure this out.
I'm trying to send an uppercase A if CAPS LOCK is on and a lowercase a if it's off but it just sends lower case a's.

VB.NET:
                   If Control.IsKeyLocked(Keys.CapsLock) Then
                        SendKeys.Send("A")
                    Else
                        SendKeys.Send("a")
                    End If

Any help will be appreciated :)
 
Last edited:
What happens when you write and have caps off? Pressing the key A will produce an "a", pressing keys Shift-A will produce upper "A".
When caps is on the table turns, pressing the key A will produce an "A", pressing keys Shift-A will produce a lowercase "a".
Same happens when you use SendKeys.Send, so just send "a" and it will translate correctly whether caps is on or off.
 
What happens when you write and have caps off? Pressing the key A will produce an "a", pressing keys Shift-A will produce upper "A".
When caps is on the table turns, pressing the key A will produce an "A", pressing keys Shift-A will produce a lowercase "a".
Same happens when you use SendKeys.Send, so just send "a" and it will translate correctly whether caps is on or off.

Yes of course I understand that and that's exactly how I expected it to work however it wasn't/isn't working like that. Even the code I posted above doesn't work like that. The code in my first post sends lower case A whether CAPS LOCK is on or off.

I did find the solution though thanks to your response... :)

The second line needed a lowercase A instead of the uppercase A. So the correct/working code is

VB.NET:
                   If Control.IsKeyLocked(Keys.CapsLock) Then
                        SendKeys.Send("a")
                    Else
                        SendKeys.Send("a")
                    End If

Thanks! <3
 
Oops I sorta skimmed over your post assuming you were basically explaining...and I missed the part where you actually did give me the answer LOL. I totally understand now from reading your entire post what the problem was. Thanks alot!
 
Back
Top