Inherited Form

J

Jason MacKenzie

I've created a base form that I want other forms to visually inherit from.
I've created the base project, added a form, thrown some buttons on it and
recompiled it as a class library.

I then added another project to the solution. I added and inherited form.
In the designer it looks great. However, when I run the project, the form is
not the same size, the button is not visible, and the text property of the
form is blank. Again, in the designer it looks perfect.

The whole processs seems straightforward so I'm not sure what I've missed.

Any help is appreciated,

Jason MacKenzie
 
P

Philip Fourie

Hi Jason,

We had a similar issue with our inherited forms recently. Out of
desperation we added an invisible label on the child form. This label
was placed in the bottom right corner of the form; this seemed to solve
our problem.

Don’t know why it works but it did, still does...
(We guessed it must be to do with anchoring and determing the size of
the form)

This might not work for you.

Hope it helps,
Philip Fourie
 
J

Jason MacKenzie

Hi Philip,

That's interesting. If I put a label on the form the derived form now shows
up as the same size as the base form. However the text property is not set
and the button from the base form is not visible.

Is this a known issue?

Jason
 
J

Jason MacKenzie

Also, looping through the derived forms controls collection only shows the
label. The button from the base form is not in the controls collection.
 
J

Jason MacKenzie

Figured it out:

I had overloaded the constructor in the base form and forgot to call

myBase.New() and
InitializeComponent()

Works like a charm now
 

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