I'm working on a function in a C# winforms application that will count characters entered into a richtextbox, but needs to ignore the backspace and shift keys.
Here is the code I've got for this part:
private void inputBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Back || e.KeyCode == Keys.LShiftKey || e.KeyCode == Keys.RShiftKey || e.KeyCode == Keys.Shift)
characterCount += 0;
else
characterCount++;
}
Regardless of this being included, it will still count any instance of the Shift Key. Can someone tell me where I'm going wrong? Please let me know if you need anymore information/code!
Update: Solved my own question. Keys.ShiftKey was what I needed. Posted it as an answer too.