• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 331
  • Last Modified:

Deriving from a Base Form


Hey, I'm trying to develop a large number of very similar forms (in VB.NET 2005), so I tried to use a base form, which worked great.  Created the one form with all the controls, resize, etc., and created additional classes which derive from this form class.  Very good, very impressed with VB.NET.

Ran into trouble when I tried to add a new control, such as a button, to my derived form.  I go into the designer for my derived form class, and then drop a button on it.  It is visible in the designer, and my class now has the member variable

Friend WithEvents Button2 As System.Windows.Forms.Button

BUT when I show the derived form the buttons do NOT appear.  Do I need to do something special to add a button to a class derived from a base form class??

Thanks!
0
riceman0
Asked:
riceman0
  • 3
  • 2
1 Solution
 
grayeCommented:
Something doesn't sound right...  

Are you sure you're instantiating the *derived* form (and the not base form, by mistake)?

0
 
riceman0Author Commented:

So in other words, what I'm doing should work?  If so I'll look for something I goofed up.
0
 
grayeCommented:
I use inherited form a lot... I usually leave a big "blank spot" on the base form where I anticipate that the derived form's controls will go.   You create and save the base form, then create an Inherited Form using the "Add New Item" menu, and picking "inherited form"... that will launch a picklist of all of the possible forms to inherit from.

So, yeah, it's kinda simple stuff... probably something silly you forgot
0
 
riceman0Author Commented:

Okay... glad you clarified.  I was just deriving a plain class from the base form, not an "inherited form."  Probably doesn't generate the partial classes I need... I'll try that.
0
 
riceman0Author Commented:

Yeah, that was it.  Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now