Unable to display inherited forms in designer

  • Thread starter Thread starter Rob Kraft
  • Start date Start date
R

Rob Kraft

I've created a simple form that inherits from System.Windows.Forms.Form.
However, any forms that I inherit from my baseForm will not render in
designer. The code compiles and runs successfully, but I can't see the form
in design mode and I think it would be very handy to be able to do so.
Similar posts to this question seem to have given up on finding a solution.
Does anyone have a solution? I hope MS is aware of this and fixing it.

Rob
 
Have you got a public default constructor for your form. The designer uses
this constructor to render the form.

--Saurabh
 
Have you got a public default constructor for your form.

I believe you can make that default constructor private. In case that's not
a valid constructor, but you need it for the designer.

HTH;
Eric Cadwell
http://www.origincontrols.com
 
Can you explain a but further what you mean by "not a valid constructor" ?

--Saurabh
 
Sure.

Invalid meaning you don't want instances of the class created with a zero
parameter constructor.

Mark it private and the designer can find it, but consumers of the class
cannot use it. This ensures that you can enforce initialization conditions
while also enabling designer support.

-Eric
 
Thanks for the posts, but all my code is in order. I did discover the
problem based on feedback in this thread. My baseform has an event that
handles MyBase.Load. This event fires even when a derived form (that has no
MyBase.Load) opens IN THE .NET DESIGNER, as well as RUN mode. I want my new
BaseForm to run code when the form loads. If I don't "handle" MyBase.Load,
the code won't run in either design mode or run mode. If I do handle
"MyBase.Load", then I have to deal with it running even when I try to open
the form in the .Net Designer.

I can work around this limitation now that I know what it is, but it would
sure be nice if the baseform load did NOT fire in the designer.

Rob Kraft
 
Back
Top