Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Object reference not set to an instance of an object.
Posted
Comments
Prasad_Kulkarni 20-Mar-12 4:59am    
Where's your code?
OriginalGriff 20-Mar-12 5:02am    
We can't answer that without the relevant code - what it means is that you are trying to use an object that either hasn't been set at all, or is set to null. Without the code, we could only guess as to what the problem is!
Use the "Improve question" widget to edit your question and provide better information.
[no name] 20-Mar-12 5:06am    
plz paste your code!

The easy way to find , where the exception is thrown is

1) Go to Debug Menu
2) Go to Exceptions
3) Expand common Language Runtime Exception
4)Expand System
5) Find system.NullReferenceException and check the checkbox under throw

Run the application, the application will break on the line, where the exception is thrown.
Now you have the line of code where the issue is found. Now from here you can find out the actual cause.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 20-Mar-12 17:54pm    
My 5.
--SA
You are trying to access a member of an object that is null for e.g. accessing myPersonObject.Age when myPersonObject itself is null.

Debugging through your code will help you understand the cause of the error.
 
Share this answer
 
This error will occur when you try to access a object whose value is null.
Debug the code and check which object is becoming null.
 
Share this answer
 
This error will occur when you try to access a object whoes instant is not make in your code.
first create that instant and debug your code .
at the point where you get error.
make instance of that perticular in your code
 
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