473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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?
--
WCSC (Willies Computer Software Co)
http://www.wcscnet.com
Nov 17 '05 #1
2 3587
Hi ThinkRS232,
I believe Console.ReadLine() will return null if the user presses Ctrl-C
or Ctrl-Break, you could check for this condition.

Mark R Dawson
http://www.markdawson.org

"ThinkRS232" wrote:
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?
--
WCSC (Willies Computer Software Co)
http://www.wcscnet.com

Nov 17 '05 #2
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?


Here's an example

http://www.gotdotnet.com/Community/U...3-b4fd97f9825e
Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: zapazap | last post by:
Dear Snake Charming Gurus, (Was: http://mail.python.org/pipermail/python-list/2004-January/204454.html) First, a thank you to Tim Golden, Thomas Heller, and Mark Hammond for your earlier help...
0
by: Vitaly Monatko | last post by:
Hello, I need to trap Ctrl-Break in console application. How? System.Console doesn't have any appropriate... Maybe, I should use System.IO.BinaryReader? But how to bind keyboard to binary...
4
by: John Bowman | last post by:
Hi, How can I disable the right click capability of the Web Browser control that's on a form? I only want it to display the HTML, w/ no popup menu. TIA, -- John C. Bowman
2
by: Vaibhav | last post by:
Hi, I am trying to write a web browser control Application in c#, i want to trap al http request and response header which are sent/recieved. I am new to Windows programming With Regards,...
3
by: fireloard | last post by:
I have a console application that I need to regular enter data into or restart. Is there any way I can control this console application from another C# application? This would help me automate this...
1
by: Sean Nolan | last post by:
We have implemented unhandled error trapping at the application level and log these errors to our database. One error, however, the does not get trapped is when the connection pool has exceeded the...
5
by: Mark M | last post by:
I am attempting to use a third party command-line utility (WinDump.exe) to capture network traffic for perfromance analysis. This utility when launched captures network traffic until Ctrl-C is...
24
by: tizi_de | last post by:
Hello all, I'm looking for a sample program in C to print out lines not to the standard MS Dos Box but into a different control e.g. text control. Has C the possibility to do printouts to a...
8
by: =?Utf-8?B?RyBIdXN0aXM=?= | last post by:
This is the 2nd time posting so sorry for duplications. I am using VB.NT 2005 & a standard Combobox. I've been wracking my brain over this problem for a over a month & cannot seem to find a way to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.