4
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by rohand
0

object reference not set to an instance of an object.............
when this problem arise?

in general OOP, if you are trying to access properties or methods of class without creating or instantiating object of that class then runtime throws this error. See the below code which throws error :
StringBuilder sbTest;
sbTest.Appen("employee name");

The red highlighted portion in above code throws the error as we haven't created the object of StringBuilder and we are trying to append string.

I hope it may help to you.

Mark it as solved if it solve your problem.

0

When you use sessions this error arises when there is no value to bind in Session and you use it somewhere else.

0

hey it's not only for session, if you are using viewstate and there is no value to bind and you use it , you will get this error. Also if you are using request.querystring("") and don't have correct key then also the same error throws.

0

basically when u r object is null which can be session or any object you can think of...if it is null and still you try to access it...then you get the error..

0

basically when u r object is null which can be session or any object you can think of...if it is null and still you try to access it...then you get the error..

yes that's exactly what i am trying to say that it's not only for session or view state or query string but it's for any object. :-)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.