I am using textbox and here's my problem...
I already have a handler where program will not allow anymore inputs when defined Maximum text length is reached. Here's the code:
private void txtText_KeyPress(object sender, KeyPressEventArgs e)
{
if (txtText.Text.Length > MaxLengthAllowed - 1 && e.KeyChar != 8)
{
e.Handled = true;
Console.Beep(2000, 90);
return;
}
}
Now my problem is when I press and HOLD a key (for example the letter A), it exceeds the "MaxLengthAllowed" then beeps.
Is this a fault or something like a limitation of the textbox? Or am I missing something?
This code is working fine when you are not HOLDING a key. Hence, that's my problem.