473,383 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

compiles as a form -- but not as a control

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
3 1013
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Eric Lilja | last post by:
Hello, consider this program: #include <iostream> #include <algorithm> #include <string> #include <cctype> int main() { std::string s = "HEJ";
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
3
by: Bryan Capps | last post by:
I have a text box control on a form, the value of which is calculated (concatenated) from entries on a subform. Accordingly, I've set the control's locked property to true and the tab stop...
11
by: Jozef | last post by:
I have some old code that I use from the Access 95 Developers handbook. The code works very well, with the exception that it doesn't seem to recognize wide screens, and sizes tab controls so that...
26
by: Bruno Jouhier [MVP] | last post by:
I'm currently experiencing a strange phenomenon: At my Office, Visual Studio takes a very long time to compile our solution (more than 1 minute for the first project). At home, Visual Studio...
0
by: Bruno Jouhier [MVP] | last post by:
Last september, I posted a message about abnormal compilation times in Visual Studio .NET. I got some help from a nice guy from Sweden, who had the same problem and saw my post on the newsgroup....
4
by: Rock | last post by:
I'm in the process of writing this program for complex numbers and I use DevC++. My professor on the other hand compiles on Borland 5.5. So I ocasionally save and run my work on Borland to see if...
5
by: ortaias | last post by:
I have a form which calls up a second form for purposes of data entry. When closing the data entry form and returning to the main form, things don't work as expected. When I return to the main...
19
by: Coward 9 | last post by:
HI, I saw in an example hello.aspx, there is a <form tagbeing used like <form runat="server> I search all html tag references and could NOT find "runat" attributes for <formtag. which...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.