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
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
> 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
[quoted text clipped - 10 lines]
>
> Jason MacKenzie
Jason MacKenzie - 12 Oct 2004 15:20 GMT
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
> Hi Jason,
>
[quoted text clipped - 27 lines]
>>
>> Jason MacKenzie
Jason MacKenzie - 12 Oct 2004 15:24 GMT
Also, looping through the derived forms controls collection only shows the
label. The button from the base form is not in the controls collection.
> Hi Jason,
>
[quoted text clipped - 27 lines]
>>
>> Jason MacKenzie
Jason MacKenzie - 12 Oct 2004 15:49 GMT
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
> Also, looping through the derived forms controls collection only shows the
> label. The button from the base form is not in the controls collection.
[quoted text clipped - 30 lines]
>>>
>>> Jason MacKenzie
Philip Fourie - 12 Oct 2004 16:31 GMT
Hi Jason,
Glad it worked, thanks for the feedback!
Regards,
Philip Fourie
> Figured it out:
>
[quoted text clipped - 39 lines]
>>>>
>>>>Jason MacKenzie
Philip Fourie - 12 Oct 2004 16:38 GMT
BTW do still have to resort to the invisible label?
> Figured it out:
>
[quoted text clipped - 39 lines]
>>>>
>>>>Jason MacKenzie
Jason MacKenzie - 12 Oct 2004 17:03 GMT
No. It seems to be working without it.
> BTW do still have to resort to the invisible label?
>
[quoted text clipped - 43 lines]
>>>>>
>>>>>Jason MacKenzie