0
I have the following event:
private void TelaAcao_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue.Equals(27))
{
this.Close();
}
}
The result is that every time I press ESC
, the form is closed. However, I would like that when pressing once, a method is called to clear the controls and if pressed with ALL the empty controls, he closed the screen.
How can I do that? One if()
within this first if (e.KeyValue.Equals(27))
? I have to go from field to field checking if they’re equal to "String.Empty
"?
Usually the
ESC
is used to close the screen, even has a property in the form to enable it, no need to encode any key, if you do not think it is better to use a key association?– novic
I was interested about this property, but the idea is that once the form was completed, the first
ESC
clean the screen, instead of closing directly– Lucas Bustos