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");

}
 
Back
Top