Inherited Form - Must specify value for source

  • Thread starter Thread starter Lisa Gay
  • Start date Start date
L

Lisa Gay

I have created a class library test.dll with contains several objects
including a form called frmMDIFrame. I started a new project and included
the test.dll as a reference and placed the dll in the project's execution
directory. I created a new form inherited from frmMDIFrame in the test.dll.
I am not able to view the new form in Design mode; I'm getting the following
error.

An error occurred while loading the document. Fix the error, and then try
loading the document again. The error message follows:
An exception occurred while trying to create an instance of
test.frmMDIFrame. The exception was "Must specify value for source.".

I would like to fix the error; but I have no idea what the exception means;
where is the source that I have to specify a value for?
 
Check that (1) if you do anything in the Form Load event, put it in a
"If Me.DesignMode = False Then"
and (2) that you don't initialize class variables (variables up top) -
except for simple variables, nothing like "dim m_MyClass = new CMyClass()".
The reason is that that when you open the derived form in design view, it
actually creates a live instance of the base form, which gives the errors.
You can verify this by inserting something like
MsgBox("I did not believe this") in the Form Load of the base form, and
then open the derived form in design view.
 
Back
Top