The try-catch statement consists of a try block followed by one or more catch clauses, which specify handlers for different exceptions. This statement takes one of the following forms:
The try-catch statement consists of a try block followed by one or more catch clauses,
which specify handlers for different exceptions.
This statement takes one of the following forms:
try try-block catch (exception-declaration-1) catch-block-1 catch (exception-declaration-2) catch-block-2 ... try try-block catch catch-block
where:
e.g.;
using System;public class Example13_4{ public static void Main() { try { int[] myArray = new int[2]; Console.WriteLine("Attempting to access an invalid array element"); myArray[2] = 1; } catch (DivideByZeroException e) { // code that handles a DivideByZeroException Console.WriteLine("Handling a System.DivideByZeroException object"); Console.WriteLine("Message = " + e.Message); Console.WriteLine("StackTrace = " + e.StackTrace); } catch (IndexOutOfRangeException e) { // code that handles an IndexOutOfRangeException Console.WriteLine("Handling a System.IndexOutOfRangeException object"); Console.WriteLine("Message = " + e.Message); Console.WriteLine("StackTrace = " + e.StackTrace); } catch (Exception e) { // code that handles a generic Exception: all other exceptions Console.WriteLine("Handling a System.Exception object"); Console.WriteLine("Message = " + e.Message); Console.WriteLine("StackTrace = " + e.StackTrace); } }}http://msdn.microsoft.com/en-us/library/0yd65esw(VS.71).aspxBest Luck!!!!!!!!!!!!!!!!!!!Sujit.