This is a discussion on Steps Needed within the Microsoft .NET forums, part of the Programming Talk category; I am starting my hands with exception handling of .NET class. I am trying to create a application that would ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am starting my hands with exception handling of .NET class. I am trying to create a application that would catch all different kinds of exceptions. But the exception classes provided by .NET class library do not fit my needs of application and so I am planning to create my own exception class. For doing this can someone tell me the order of steps I have to follow to create and use my new exception class.
|
|
|||
|
I have given below the steps that you need to do for carrying out your required purpose:
First create a new class that inherits the Exception class. That is you have to create exception class derived from an Exception type of class. Secondly call the New method of the base class to initialize the base class. That is call the base class constructor in the class constructor. Then create custom properties or methods for your exception class. Then to cause the exception within the client the object that throws the exception must use Throw with the New Keyword and the name of the exception class. At last catch an exception that is based on the name of your exception class. For this in the client use a Try..Catch..Finally..End Try block to catch and handle the specific type exception. |
![]() |
| Thread Tools | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What Permission Needed | sammy | Linux | 1 | 05-19-2007 04:33 PM |
| Best Option Needed | cyrus | SQL Server | 1 | 05-18-2007 04:00 PM |
| Tutorial on Silk Test | spriya279 | Testing Tutorials | 2 | 02-15-2007 07:31 PM |
| Is there Healthcare facilities at door steps | Rahulbatra | Chit-Chat | 1 | 12-19-2006 03:22 PM |
| Documents needed for Green Card Processing | Vasu | Immigration Help | 1 | 10-11-2004 10:46 PM |