Resolved Creating a Base form

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,530
Location
Lansing, MI; USA
Programming Experience
10+
I'm working on a simple base form in which all the other forms in the project will inherit. This base form only adds 5 properties (at the moment) dealing with painting a gradient background. The problem I'm facing right now is when I change a property on Form1 (the test form) and click run it doesn't show that change. I also checked the .designer.vb file and when I make a change it's not added to the code behind file, I'm at a loss right now to why.

Here's the test project while I'm building the thing. Gradient form is the base form, form1 simply inherits it.
 
Removing the DesignerSerializationVisibility attribute did the trick, I'd forgotten to take it out when I copied the code from another project.
 
JB, I would have thought the class you were making would have had to inherit from the Form class. Like when I am making a new button I inherit from Button. Your paint sub paints Me, so it recognizes Me as the form since it inherited this custom class? I guess I just learned something new. ;)
 
JB, I would have thought the class you were making would have had to inherit from the Form class. Like when I am making a new button I inherit from Button. Your paint sub paints Me, so it recognizes Me as the form since it inherited this custom class? I guess I just learned something new. ;)
GradientForm.Designer.vb:
VB.NET:
Partial Class GradientForm
    Inherits System.Windows.Forms.Form
That is how the Designer generated code is organized since VB 2005. The user code simply specifies same class name:
VB.NET:
Public Class GradientForm
 
Yea, this "class" is really basic right now, I'll be adding more to it when I get back to it. Eventually this form will become it's own project as a class library and I'll be able to drop it into existing projects and change all the inheritance(s) to it then changing a few properties will transform the look of the form.
 
Back
Top