If you press and hold the 5 key on the numpad it will continue to execute a statement in the KeyDown event handler. How can i ensure the statement is executed only once, even if i hold the key down?
Thanks for your attention.
private void form_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.NumPad5)
{
dados.enviar("f"); //I want this to run only once!
}
}
You can set flag on key down and reset it on key up.