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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
AlanRank #669 · 3.6K reputationPosted Aug 4, 2008, 6:34 AM EDT
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.