© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
46 replies
stigzler

❔ Winforms Property from BaseClass Form not getting transferred to derived Form

Hi. Don't know if you guys can help an amateur. I know most of you guys don't like winforms, but...

namespace MyApp.Common
{
    public partial class BaseForm : Form
    {
        private Guid _guid = Guid.NewGuid();
        public Guid GUID
        {
            get { return _guid; }
            set { _guid = value; }
        }

    }
}

namespace MyApp.Presentation
{
    public partial class Admin : BaseForm
    {

    }
}
namespace MyApp.Common
{
    public partial class BaseForm : Form
    {
        private Guid _guid = Guid.NewGuid();
        public Guid GUID
        {
            get { return _guid; }
            set { _guid = value; }
        }

    }
}

namespace MyApp.Presentation
{
    public partial class Admin : BaseForm
    {

    }
}


When I bring up the form "Admin" in designer view, it opens with a new Guid every time (obs using the base class Guid), unless I manually set Guid myself and then it adds it in Admin.Designer.cs.this.Guid="(whatever)" - this is missing until I manually add it. Is there any inheritance trick I can pull in the base class to force VS to create the this.Guid in Admin.Desginer.cs. Been messing around with this all day now! 🧱
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Derived class , BaseClass, Dictionary
C#CC# / help
2y ago
❔ WinForms Topmost property not working as intended.
C#CC# / help
3y ago
Add attribute to property in base class from derived class when base property already has attribute
C#CC# / help
3y ago
❔ ✅ I can't convert List<BaseClass> to List<T> where T: BaseClass.
C#CC# / help
4y ago