
- Forum
- Programming Talk
- Microsoft .NET
- Steps Needed
Steps Needed
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 ...
-
06-05-2007, 04:00 AM #1
- Join Date
- Apr 2006
- Answers
- 124
Steps Needed
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.
«
How to create
|
Help on Flag
»

Reply With Quote





