0
I have an application with digit buttons and want to capture keystrokes and run the events of these buttons. I added an event of keypress
in the window and tried to capture the typed key, but could not.
Code:
private void CalculadoraDS2_KeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar.GetType == '0')
{
btn0.PerformClick();
}
}
The estate
KeyPreview
form has to be set totrue
so that you can manipulate this event. You have already checked it?– gato
@Matheusmiranda attribute "Keycode" does not exist, and is Windows Form Application
– Daniel Santos
@cat I modified it and it didn’t work ...
– Daniel Santos
@Danielsantos da a look here I have no time to answer now.
– gato