1
Hello, I am with the following question, I have installed a new form with the following code:
Form frmDialog = new Form();
Well, I want to do the following, in the form in which I instituted this new Form, I can use the following code:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch(keyData)
{
case Keys.Escape:
Close();
break;
}
return base.ProcessCmdKey(ref msg, keyData);
}
I wanted to know how to instantiate this method to work in frmDialog (New form.)
What this code does: When I press the Escape key (ESC), the form closes.
It needs to be with this method of yours
ProcessCmdKey
? It cannot be using theKeyDown
in frmDialog?– Ismael
It didn’t work, but thanks anyway, I was trying to do with the Keyup and Keypress events, now I know that event.. :)
– Lucas Bittencourt
Opa, now yes! Thanks, now I know why I could not use these events in the form.... Thanks really! :)
– Lucas Bittencourt