Form Designer doesn't work with Inherited Forms!!!!!

  • Thread starter Thread starter Dominic Birrer
  • Start date Start date
D

Dominic Birrer

have tried several different approaches to try and get the
Visual Studio VB.NET to work with Inherited Forms. Every
approach I have tried results in the display of an error
message in the Designer View for the inherited form class.
The following error is displayed: "An error occurred while
loading the document. Fix the error, and then try loading
the document again. The error message follows: The
designer could not be shown for the file because none of
the classes within it can be designed. The designer
inspected the following classes in the file: MainForm ---
The base class 'myforms.formtest' could not be loaded.
Ensure the assembly has been referenced or built if it is
part of the project."

WHAT I'VE DONE:
I've created a new class library (myforms) with a base
form baseform (including some company typical stuff).
afterwards I've created a new additional form formtest
inheriting my baseform within the same project - and it
works fine. I'm able to add some additional stuff to the
formtest ....

Now I'm trying to inherit the formtest within an other new
project - no chance, always the error described....but the
funny point is: it's possible to run the new form !! but
I' can't modify it.....

PLEASE HELP ! I

Regards,
Dominic
 
I've suffered from similar issues with designing inherited forms.
In my case if the base form does not have a default constructor, the
designer gets lost and reports an error. It made perfect sense for me to
have an abstract base class for some of my forms, but I can't.

I haven't tried your scenario though.
 
Hi Dominic,

The forms designer is generally pretty flaky regarding inherited forms but
it can be made to work. Your base form will actually be instantiated by the
designer at design time. If you have any constructor code that could fail at
this time then this could be causing your problem. You could test the
DesignMode property to bypass such code at design time.

Cheers

Doug Forster
 
Back
Top