Exforsys

Online Training

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 ...


Go Back   Exforsys > Programming Talk > Microsoft .NET

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-05-2007, 04:00 AM
Senior Member
 
Join Date: Apr 2006
Posts: 145
Rahulbatra is on a distinguished road
Thumbs up 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-06-2007, 07:45 AM
Senior Member
 
Join Date: Apr 2006
Posts: 122
rachelle is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

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


All times are GMT -4. The time now is 01:00 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.