.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Exception handling

Posted By: Ramesh P     Posted Date: October 19, 2010    Points:2   Category :C#
Explain about exception handling?

Responses
Author: Asha.MP             
Posted Date: October 20, 2010     Points: 5   

Exception handling is the process of handling the exception in the application.
ex:
a is of type string variable
when you try to convert it into integer you will get the InvalidCastException exception.
you can handle that exception by using try-catch

Dim strVar As String = "Asha"
'strVar is of type string
Try
Dim intVar As Integer = strVar
'Trying to convert string to integer
Catch ex As Exception
'Catching the exception
Console.WriteLine("Error in Convertion")
End Try

Thanks and Regards,
Asha.mp
Author: Don             
Posted Date: January 11, 2011     Points: 5   

It is simply putting the code where there is a chance of an exception or error in a try block..Try block will be followed by a single or multiple catch blocks which will catch the exception and handles it properly.
Example
Try
{
Openfile(location)
}
Catch(FileNotfindException)
{
Print("file not found");
}
I think it is pretty clear now..
It just make sure that application don't end abruptly..
It gives a message to naïve user what has actually happened.




Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend