Can't place controls on inherited form?

  • Thread starter J. Alan Rueckgauer
  • Start date
J

J. Alan Rueckgauer

I have a simple form with a user control docked to the top (a panel, a
picturebox, and 2 labels), a panel docked to the bottom, and a panel in the
middle that has its docking set to fill. If I inherit that form, controls
that I add to the center panel in the IDE "disappear" as soon as I build.

The controls are not actually being deleted. The designer just isn't
generating the code to add them to the panel's control collection. I tried
manually inserting the code in the designer section but compile (naturally)
erases it. However, if I manually place the .controls.add code in
form_load, it works.

What's up with this? BTW, VB.NET 2003, Framework 1.1 w/SP, XP SP2. I
haven't tried this with 2005 yet.

Thanks,
Alan
 
C

chanmmn

You need to use Overridable and Overrides keywords like belong:

Class A
Public Overridable Sub F()
Console.WriteLine("A.F")
End Sub

Public Overridable Sub G()
Console.WriteLine("A.G")
End Sub
End Class

Class B
Inherits A

Public Overrides NotOverridable Sub F()
Console.WriteLine("B.F")
End Sub

Public Overrides Sub G()
Console.WriteLine("B.G")
End Sub
End Class

chanmm
 

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