.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 >> Windows Application >> Post New QuestionBookmark and Share Subscribe to Forum

Exception Handling in Own Massage

Posted By: Naim Khan     Posted Date: November 01, 2009    Points:2   Category :Windows Application
Hello sir
do you have any idea how can handle the DataGridView
exception in Own Message like when i put the string values in cells then they are given me big exception which is not good to understand for client. so please tell me how to change this exception in own message and if any idea about validation in cells then let me know cells only accept int or decimal values not take string values

Thank in Advance

Responses
Author: Lakhan Pal Garg             
Posted Date: November 01, 2009     Points: 5   

Hi Naim -

Bind your GridView Items in DataBound Event and Add try catch (For Specific Exception type) there to Catch the error and show user friendly message to user.

Thanks & Regards
Lakhan Pal Garg
http://lakhangarg.blogspot.com/

Author: saminathan L             
Posted Date: November 04, 2009     Points: 5   

The thrown exception can be caught or dealt within the calling method using the try...catch block.
The code that may throw an exception which we want to handle is put in the try block. This is called an attempt to catch an exception.
The code to handle the thrown exception is placed in the catch block just after the try block. This is called catching the exception. We can define which particular class of exception we want to deal in this catch block by mentioning the name of exception after the catch keyword
Multiple catch blocks can be defined for a single try block where each catch block will catch a particular class of exception.
The code that must always be executed after the try or try...catch block is placed in the finally block, placed just after the try or try...catch blocks. This code is guaranteed to always be executed whether the exception occurs or not.
When an exception is raised during the execution of the code inside the try block, the remaining code in the try block is neglected and the control of execution is transferred to the respective catch or finally block.

Author: krishana singh             
Posted Date: October 16, 2010     Points: 5   

catch(exception ex)
{
messagebox.show("own message");
}



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