Visual Form Inheritence Problem

  • Thread starter Thread starter kevin
  • Start date Start date
K

kevin

Perform the following steps:

* Create a base form.
* Place a panel on the form.
* Place a button on that panel.
* Build the project (I love this needless step, it makes me appreciate
Delphi so much more).
* Create an inherited form based on the first form.
* Place a button on the panel.
* Build the project.

Then watch as the button you placed on the form miraculously disappears.
Where has it gone? It's still there, just hidden. It seems that VS.NET
2003 gets confused because the panel is defined in the base form! It
keeps stripping out the code that adds the button to the panel in the
inherited form.

Please tell me that Microsoft has a patch for this because it is holding
up my project.

Thanks,
Kevin.
 
A colleague and I have encountered similar problems when inheriting from
panels and tabpages and then dumping inherited combo boxes on the panel!
Everything just totally messes up, fontsizes of items in combo and listboxes
change - if your lucky, or things simply disappear after switching to Design
View a couple of times.

Anyone from MS who can confirm (or not) that Visual Inheritance with Design
Time support is working correctly in VS.NET 2003?

Thanks a bunch,
Wim Hollebrandse
http://www.wimdows.com
http://www.wimdows.net
 
See response below...

Wim said:
A colleague and I have encountered similar problems when inheriting from
panels and tabpages and then dumping inherited combo boxes on the panel!
Everything just totally messes up, fontsizes of items in combo and listboxes
change - if your lucky, or things simply disappear after switching to Design
View a couple of times.

Anyone from MS who can confirm (or not) that Visual Inheritance with Design
Time support is working correctly in VS.NET 2003?

Thanks a bunch,
Wim Hollebrandse
http://www.wimdows.com
http://www.wimdows.net

Actually... I've found out the cause of the problem. I tried to cancel
my original post, but since you have replied to it I should post the
solution for the benefit of the community. :-)

If I make the panel "protected" (it is private by default) then
everything is happy and the button doesn't just disappear. And this
actually makes logic sense now that I think about it...

I wish the IDE would warn me before it strips out the code to add the
button to the panel. However, since I now know what causes the problem
I can work around it.

Hope this is useful to other developers.

Cheers,
Kevin.
 
Back
Top