Click here to Skip to main content
16,017,726 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
this error displed web page head...but program runned,,,hoe to hide that error..
Posted
Comments
Why you need to hide the exception ?
Try to find out the cause by debugging line by line and correct your code.

You have not provided any code to look at. Please post some code.
Ian A Davidson 4-May-13 3:16am    
You need to fix your code, not hide the error. This indicates a serious coding mistake somewhere.

Somewhere in your code, you are trying to use a variable which contain null as if it contained an actual value, by accessing it's properties or methods. While it is possible to "hide" the problem as you mentioned by using try...catch blocks effectively, it is as Tadit and Ian have said a bad idea.

When you code meets a null variable in that way, it throws an exception and execution of your code stops, and goes to a handler (if any - if none, then you get a message just like you do now). Hiding the message just means that whatever code you wrote to do sotheing with your page will not be executed, and there is no way to make it be executed other than to fix the error properly.

Look at teh error message: it will tell you a file and the line number in teh file that caused the problem. Look at it, and see which variable could be null. If you can't spot it, then we need to see the relevant code fragment that causes the error - not the whole file, just the line and say ten or twenty lines each side, maybe the whole method.
 
Share this answer
 
This error occurs when you try and access a member of an object that is null.
If you can debug your source code, you should be able to solve the problem.

You can suppress this error by using the right error handlers in your code.
However, this is not the recommended approach - rather you should try and fix the problem.
 
Share this answer
 
please check you data if data is null then this kind of error accrued.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900