Thread: how to shut down console app in an error trap

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    20

    how to shut down console app in an error trap

    Code:
       public static void tan_chin()
            {
                switch (jw.offspring[10])
                {
                    case 1:
                        tan_chin_normal();
                        break;
                    case 2:
                        tan_chin_steel();
                        break;
                    case 3:
                        tan_chin_harli();
                        break;
                    case 4:
                        tan_chin_orange();
                        break;
                    default:
                        Console.WriteLine("Error! Bad data on 'E' loci. Quitting.");
                        Console.WriteLine("press any key");
                        Console.ReadKey(); // waits for any key to be pressed
                        break;
                }
    
    
                return;
            } // end tan_chin
    how do I terminate the program if it falls thru to default?
    Main method is void

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    I guess you could Environment.Exit().
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Abort Trap Error
    By DrSeptapus in forum C Programming
    Replies: 2
    Last Post: 12-07-2010, 11:06 AM
  2. How to trap ESC key pressed without getch()?
    By RAJJUMOTE in forum C Programming
    Replies: 3
    Last Post: 08-08-2007, 03:06 PM
  3. Error Trap for a 2nd decimal
    By ropewrench in forum C Programming
    Replies: 4
    Last Post: 07-03-2005, 11:23 PM
  4. how to trap Ctrl + Alt + Del
    By samudrala_99 in forum Windows Programming
    Replies: 5
    Last Post: 12-16-2002, 01:01 AM
  5. how often do you shut down?
    By WayTooHigh in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 10-12-2001, 02:18 PM