I am trying to process to keydown event but the below code is process only first char of string and not able to remove second char of string.
private void Game_KeyDown(object sender, KeyEventArgs e)
BirdsArray[SelectedIndex].THIS_STRING = BirdsArray[SelectedIndex].THIS_STRING.Remove(0, 1);
In this below code
BirdsArray is array of panels,
THIS_STRING is a string type of string object in
Best How To :
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 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
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.