Error loading design screen for an Inherited form

B

Brandon Owensby

I am using MDE 2003 version 7.1.3088 with .NET Framework 1.1. I have a C#
program with a Windows Form I want to inherit from. When I create the
inherited class I get an error when I try to go to the design screen. It
says that there was an exception trying to get an instance of the base
class. The exception is "Object reference not set to an instance of an
object". How can I find out where in the base class this is happening.
What do I do? If I run the program and bring up the inherited form it works
fine....I just can't open it in the design window to change whats on the
screen. My goal is to add controls to the new screen that weren't on the
original one.

Brandon
 
R

raj

you probably have some sort of variable that is not set to any value
this is done in the constructor of that class. so if i were you i would go
to
the constructor and start to look for variables that may be not set to null
or has no
value assigned.

If you cannot still it then cut all the code from the consturctor and start
to put back
a few lines and test it out...rinse and repeat.... there are no other ways
to do this within the
studio or with any tool but to do it manually. but it will be in the
constructor.

raj
 
C

Colin Neller

Brandon,

If you are still having trouble, follow these steps:

- Open the solution that contains the inherited form
- Close all open windows in this instance of Visual Studio (what you
refer to as MDE)
- Open a second instance of VS, but this time don't open any solutions
or projects
- Verify that there are only 2 instances of VS (devenv.exe) running.
This will avoid confusion in the next step.
- In the second instance of VS, open the "Processes" dialog (Tools >
Debug Processes...)
- Select "devenv.exe" in the top pane, and click the "Attach..." button
- Make sure "Common Language Runtime" is the only box checked", and
click "OK"
- Click "Close" in the "Processes" dialog
- Open the "Exceptions" dialog (Debug > Exceptions...)
- Select "Common Language Runtime Exceptions"
- In the "When the exception is thrown" box, select "Break into the
debugger"
- Click "OK" in the "Exceptions" dialog
- Return to your original instance of VS
- Open the inherited form that you were having trouble with design mode
- At this point, the second instance of VS should break on the line
that is causing the exception.

Hope that helps

Colin Neller
http://colinneller.com/blog
 
B

Brandon Owensby

Thank you both for your help. I'm do not understand why this caused it to
blow up but my exception was being caused because I was trying to get an
instance of another class and setting it as the value of a one of my class
variables. Apparently it didn't like that. I had to make it so the the
line that looked like the following:

this.classVariable = new Class();

was placed such that it didn't get executed from the designer but did when I
ran the program and a new instance of that window was generated. The class
was one I wrote and I'm not sure what about it the designer didn't like.


Thanks again,
Brandon
 

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