By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,032 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,032 IT Pros & Developers. It's quick & easy.

compiles as a form -- but not as a control

P: n/a
I have a collection of controls that represent an address in my project. I wanted to make them into an address control because lots of the business objects I am working with have addresses.
I got a nice set of control that visually represent the data I need -- but when I aggregated the controls and code into a VB user-control, the designer gives me the pink screen of death and reports OBJECT REFERENCE NOT SET TO A VALID INSTANCE OF AN OBJECT,

Since the debugger will not parse code inside a user-control, I can't find the object which is giving me problems.
her is the message I get...

One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes.

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

at System.ComponentModel.ReflectPropertyDescriptor.Se tValue(Object component, Object value)
at System.ComponentModel.Design.Serialization.CodeDom SerializerBase.DeserializeAssignStatement(IDesigne rSerializationManager manager, CodeAssignStatement statement)
at System.ComponentModel.Design.Serialization.CodeDom SerializerBase.DeserializeStatement(IDesignerSeria lizationManager manager, CodeStatement statement)

Feb 13 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Have you tried removing the <System.Diagnostics.DebuggerStepThrough()>
attribute from the user control? That might allow you to step into the
control with the debugger.

Feb 13 '06 #2

P: n/a
Hi Bill,

So you created a class, and you instanced the class on a form at design
time. This class probably contains code with references to a database or an
other object that isn't available at design time.

What you need to do is to enclose those references in the following if
statement

If Not Me.DesignMode Then
.... reference MyObject
End If

The enclosed bits of code are executed at run-time but ignored in the
designer.

Hth,
Martin
"Bill Angus" <md*****@dont-spam-me.psychtest.com> wrote in message
news:Oy**************@TK2MSFTNGP10.phx.gbl...
I have a collection of controls that represent an address in my project. I
wanted to make them into an address control because lots of the business
objects I am working with have addresses.
I got a nice set of control that visually represent the data I need -- but
when I aggregated the controls and code into a VB user-control, the designer
gives me the pink screen of death and reports OBJECT REFERENCE NOT SET TO A
VALID INSTANCE OF AN OBJECT,

Since the debugger will not parse code inside a user-control, I can't find
the object which is giving me problems.
her is the message I get...

One or more errors encountered while loading the designer. The errors are
listed below. Some errors can be fixed by rebuilding your project, while
others may require code changes.

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

at System.ComponentModel.ReflectPropertyDescriptor.Se tValue(Object
component, Object value)
at
System.ComponentModel.Design.Serialization.CodeDom SerializerBase.DeserializeAssignStatement(IDesigne rSerializationManager
manager, CodeAssignStatement statement)
at
System.ComponentModel.Design.Serialization.CodeDom SerializerBase.DeserializeStatement(IDesignerSeria lizationManager
manager, CodeStatement statement)
Feb 13 '06 #3

P: n/a
Thanks Chris:

After reading your post, I found a line such as you describe in the designer generated code.... (which we are instructed not to edit). However, if I comment out this attribute, I still cannot step through the code of the user-control at run time. Can you tell me am I looking in the wrong place to try to get the debugger to allow me to debug code of a user-control as per your suggestion?
<System.Diagnostics.DebuggerStepThrough()> _

Private Sub InitializeComponent()

Thanks all for your suggestions.

Bill Angus, MA
http://www.psychtest.com
"Chris Dunaway" <du******@gmail.com> wrote in message news:11**********************@o13g2000cwo.googlegr oups.com...
Have you tried removing the <System.Diagnostics.DebuggerStepThrough()>
attribute from the user control? That might allow you to step into the
control with the debugger.

Feb 13 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.