Hi there,
somenthing very easy but it doesnt work.
If you click the key "ESC" then close the whole application:
private void frmLogin_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Escape){
application.exit();
}
}
Hi there,
somenthing very easy but it doesnt work.
If you click the key "ESC" then close the whole application:
private void frmLogin_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Escape){
application.exit();
}
}
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
AlanPosted Aug 4, 2008, 10:34 AM
In the Properties Box for the form, try setting its KeyPreview property to true.
Incidentally, the KeyDown eventhandler only captures keystrokes (i.e. pressing the Esc key), not button clicks.