We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Object Reference Not Set to Instance of an Object

I am trying to add webservices to my project and I keep getting "Object Reference Not Set to Instance of an Object" in the designer. I have tried everything. Basically I am inheriting a form and in the project I have created web services (if i do not include webservices in my project the form comes up fine, but when I do I get the above error) Does anyone have any ideas??? Thanks

2 Replies

AD Administrator Syncfusion Team June 27, 2003 08:56 AM

Hi Jody, Can you post this in the Windows Forms FAQ forum? Best regards, Daniel Syncfusion, Inc


MA markvanber February 8, 2022 12:14 AM

An Object is an instance of a Class , it is stored some where in memory. A reference is what is used to describe the pointer to the memory location where the Object resides. The message "object reference not set to an instance of an object" means that you are referring to an object the does not exist or was deleted or cleaned up. It's usually better to avoid a NullReferenceException than to handle it after it occurs. To prevent the error, objects that could be null should be tested before being used.


if (mClass != null)

{

  // Go ahead and use mClass

  mClass.property = ...

}

else

{

  // Attempting to use mClass here will result in NullReferenceException

}




Loader.
Live Chat Icon For mobile
Up arrow icon