hi to all
can any one explain detailed about exception handling in c# with some examples
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Kirtan PatelRank #292 · 8.6K reputationPosted Dec 27, 2009, 8:14 PM EST
Try below articles available on Site it self
http://www.c-sharpcorner.com/UploadFile/rekhasingh1610/208192009021309AM/2.aspx
http://www.c-sharpcorner.com/UploadFile/skumaar_mca/ExceptionHandling09142009012625AM/ExceptionHandling.aspx
srinivas137 reputationPosted Dec 27, 2009, 9:15 PM EST
thank you
Kirtan PatelRank #292 · 8.6K reputationPosted Dec 27, 2009, 9:41 PM EST
suppos for example you want to throw exception when user enters name = "user" in textbox then you can do this
like below
string str = TextBox1.Text;
if(str == "user")
{
Exception myex = new Exception("My Own Exception");
throw myex;
}
that will generate your own exception :)
srinivas137 reputationPosted Dec 27, 2009, 10:28 PM EST
catch(myex)
{
//some message
}
is this is correct or any other process is there
and can you explain about user defined exceptions
Kirtan PatelRank #292 · 8.6K reputationPosted Dec 27, 2009, 10:30 PM EST
and User defined Exception = Own own exception i shown you process in above post how to throw it :)
srinivas137 reputationPosted Dec 27, 2009, 10:34 PM EST
I saw some where that for user defined exception we have to derive System.ApplicationException class what it means
Kirtan PatelRank #292 · 8.6K reputationPosted Dec 27, 2009, 10:39 PM EST
this type of exception is thrown by the application when non fatal error occur in application
srinivas137 reputationPosted Dec 27, 2009, 10:45 PM EST