Hi Goutsev,
Thank you for a quick reply. Unfortunately the project is rather extensive,
with four projects and a lot of references to our own dll:s.
We're working on breaking out some code at the moment, if the problem still
persists tomorrow when that part should be done, I'll try to make an example
solution with only two - three usercontrols and post it here.
If you come up with some other bright ideas until then - don't hesitate to
tell me.
/Emma
"Stoitcho Goutsev (100) [C# MVP]" wrote:
> Hi Emma,
>
> The best would be if could post some working sample that demonstrates the
> problem. I understand that your project could be rather big to post it in a
> ng, but at least you can post the stack trace of the exception.
> Or if you want to you can send me some part of the project that demonstrates
> the problem at guzzev(at)yahoo(dot)com.
>
> BTW if it happens (as I understant it is) at design time you can debug
>
> You can start a new instance of VS.
> Open the project in this instace.( now you have the project open twise)
> In one of the insances go to 'Debug' menu and click on "Processes..." in the
> dialog attach the debuger to the other VS
> You can set exception settings to stop on all exceptions. You can set some
> breakpoints as well. In the second VS add the user control to the parent and
> so on.
>
> This can be done via the projects setting but as long as you don't write
> designers this method of debugging is better for your needs, I believe
>
> --
> HTH
> Stoitcho Goutsev (100) [C# MVP]
>
>
> "Emma" <(E-Mail Removed)> wrote in message
> news:F82AA5EE-E483-47F4-8E0C-(E-Mail Removed)...
> > Hi,
> >
> > I'm developing a GUI with almost all Usercontrols. It's been working
> > wonderfull up till a few weeks ago, and really crashed yesterday.
> >
> > Suddenly I can no longer add some of my usercontrols to any of the others
> > (I've also tried to create new usercontrols and windowforms and add them
> > to
> > the new control, but that doesn't work any better). It's really
> > frustrating
> > since I've been able to add them and run the program before.
> >
> > To debug I've put some messageboxes in my constructors of the uc beeing
> > added, and it seems to go just fine, so now I'm wondering where the
> > errormessage comes from. The error being "Object reference not set to an
> > instance of an object".
> >
> > The only variable holding an object in the usercontrol is a variable that
> > holds a reference to another usercontrol, but that is instanciated in
> > runtime, and is only declared in the header. I've tried to assign it a new
> > instance, but it doesn't change the outcome and the error still appears. I
> > have a few variables that have get-set-methods in the usercontrol to be
> > able
> > to set unique ID-numbers in designtime on the usercontrol thery're placed,
> > but they're one of system definied types (string, bool and int).
> >
> > I've been searching the web for others with this problem but unfortunaly
> > only find people who's forgotten the = new object declaration. So to
> > summarize:
> >
> > 1. I try to drag a usercontrol (ucChild) on to another usercontrol
> > (ucParent)
> > 2. It goes through the ucChilds constructor without a problem
> > 3. Just as ucParent is about to show the ucChild something happens and I
> > get
> > to see: "An exception occurred while trying to create an instance of
> > myUserControl. The exception was 'Object reference not set to an instance
> > of
> > an object.'". (I can see the ucChild-size show up in the ucParent and
> > dissappear just before the error message shows up.
> >
> > So even if the error message says it has to do with my ucChild, I'm
> > starting
> > to think that it's on the ucParents rePaint (or somewhere else) it just
> > goes
> > wrong. Any ideas, anyone?
> >
> > /Emma
>
>
>
|