Object reference not set to an instance of an object

J

Joe

Gurus, Please help me.
When we try to open a designer of a form, this is what we get.

Object reference not set to an instance of an object.
Hide

at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object
component, Object value)
at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager
manager, CodeAssignStatement statement)
at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager
manager, CodeStatement statement)

Does anybody have any idea.
Thanks for any help you can provide.
Joe
 
S

Scott M.

It means that you are using a variable that has not been set to an actual
instance of a type. For example, in VB .NET this would cause such an
exception

Dim tb As Textbox
tb.Text = "something"

This code shows the variable tb being declared as a pointer to a place in
memory that holds an actual Textbox instance, but it does not actually
create a new Textbox instance. So, when you attempt to place data into the
text property of tb, you will get an object reference (tb) not set to an
instance of an object (a textbox) because there is no actual textbox in
memory to set the text property of.

Usually this error is caused by forgetting the keyword "new" (C# and
VB.NET), so the line should read:

Dim tb As New Textbox 'This creates a new textbox instance in memory and
points the variable tb to it
tb.Text = "something"

We need to see your code (not just the stack trace) to tell you where
exactly your problem is.
 
R

Rad [Visual C# MVP]

Gurus, Please help me.
When we try to open a designer of a form, this is what we get.

Object reference not set to an instance of an object.
Hide

at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object
component, Object value)
at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager
manager, CodeAssignStatement statement)
at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager
manager, CodeStatement statement)

Does anybody have any idea.
Thanks for any help you can provide.
Joe

Hi,

What version of Visual Studio are you using? If its Visual Studio 2005
read this article

http://www.codeproject.com/csharp/wsod.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top