The KeyDown event gives you the virtual key code of the key that was pressed. Like Keys.A if you press the A-key. It just tells you about the key, not about the letter that's produced by the key. Which depends on the active keyboard layout (it is not an A in Japan or Russia for example) and what modifier keys are down. Shift being the obvious example, producing either A
or a
. Or Alt which, when down, doesn't produce a letter at all.
So your code will work by accident if the first letter of the string is capitalized. You'll run out of luck when the rest are not. A
does not match a
.
It is pretty unclear to me why you need this feature. Do consider the KeyPress event instead. Which gives you the actual letter that the user sees on the screen.