How do I trap Control C in a Console C# .Net application.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a console application that needs to do a cleanup if the users abort
with a Control C or Control break. How can I trap this signal in my Visual C#
..Net application?
 
if you want to trap event for any controls you can write their event otherwise you can directly write events available for Form control like following


private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control == true && e.KeyCode == Keys.S)
MessageBox.Show("Ctrl+S");

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top