Object reference not set to any instance of object

Posted by Srikrishna777 under C# on 12/23/2009 | Views : 1606 | Status : [Member] | Replies : 6
Hi,

I am getting "Object reference not set to any instance of object" when I am trying to view the form at design time.This error is coming continuouly and stopping me to go ahead.
I have checked,whether If any values are not assigned or any values are null.But,all looks correct.
What could be the reasons for this type of problem.I appreciate your advice on this.

Thanks,
M.Srikrishna




Responses

Posted by: Vuyiswamb on: 12/23/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
What VS Version are you using ?

Can we see the HTML of that Form. Post it and its cs File so that we can try to reproduce the problem on our side.

Thank you for posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Srikrishna777, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Komminedi on: 12/24/2009 [Member] Starter

Up
0
Down
Hi,

Try to instantiate the class which you are using... Suppose if you are using class A then

A a1 = new A();

I hope this will help you.

Srikrishna777, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mehulthakkar1 on: 12/31/2009 [Member] Starter

Up
0
Down
Hi,

In windows form, you can't not create any class over the actual form class. your form class should be first in your cs file.

if it is like this then may this help you out.

Thanks
Mehul Thakkar

Srikrishna777, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Krishnavenikaladi on: 1/5/2010 [Member] Starter

Up
0
Down
hi,
instatiate the object.if class c1 is class
c1 obj=new c1();

Srikrishna777, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bubbly on: 1/11/2010 [Member] Bronze

Up
0
Down
Hello,

You must not have initialized properly. Can you post your code?

++
Thanks & Regards,
Deepika

Srikrishna777, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Puneet20884 on: 1/16/2010 [Member] Bronze

Up
0
Down
There can be so many of reason for this, Please check your code for following, resolution also given:

An object is extended to ToString() while it is NULL (If so, use Convert.ToString(objectname)) object may be cookie or session etc.

Dropdownlist is setted to any value which not in the items of it.

Object of a class is used but either disposed earlier or not instantiated (could be)

If not so, there is a simplest approach which is a layman approach, comment one by one blocks of code and see where the issue coming, and debug that portion.

Better if you can provide source code if don't mind !!

Best Regards,
Puneet Sharma - Infosys
Pune, India

Srikrishna777, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response