Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / October 2004

Tip: Looking for answers? Try searching our database.

Inherited Form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jason MacKenzie - 12 Oct 2004 14:10 GMT
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
Philip Fourie - 12 Oct 2004 15:05 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.