Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8837311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:41:29+00:00 2026-06-14T09:41:29+00:00

Consider a custom control that has a property Rows: private EMRow[] _rows; public CustControl()

  • 0

Consider a custom control that has a property Rows:

private EMRow[] _rows;

public CustControl()
{
    InitializeComponent();
}

public EMRow[] Rows
{
    get
    {
        return _rows;
    }
    set
    {
        _rows = value;
    }
}

Each EMRow creates a TextBox and exposes two properties, one for the Text and one for the control itself:

private TextBox _txtValue;

public EMRow()
{
    if (_txtValue == null)
        _txtValue = new TextBox();
}

public string Value
{
    get
    {
        return _txtValue.Text;
    }
    set
    {
        _txtValue.Text = value;
    }
}

public TextBox ValueTextBox
{
    get
    {
        return _txtValue;
    }
    set
    {
        _txtValue = value;
    }
}

If you drop this custom control onto a form and modify the Value property, it updates and safes the changes to the designer.cs file.

When you drill down into the ValueTextBox properties (again, all of this in visual studio designer, not code) and modify a property the changes are NOT saved to the designer.cs file. As far as the designer is concerned, there isn’t even a TextBox object created and referenced to this property.

I’m sure this is ‘as expected’ behavior but I’m stumped as to why. Am I missing a fundamental for VS designer here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:41:32+00:00Added an answer on June 14, 2026 at 9:41 am

    After some digging I found the solution to this problem, tell the designer to serialize this object itself by adding the DesignerSerializationVisibility attribute

    private TextBox _txtValue;
    
    public EMRow()
    {
        if (_txtValue == null)
            _txtValue = new TextBox();
    }
    
    public string Value
    {
        get
        {
            return _txtValue.Text;
        }
        set
        {
            _txtValue.Text = value;
        }
    }
    
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    public TextBox ValueTextBox
    {
        get
        {
            return _txtValue;
        }
        set
        {
            _txtValue = value;
        }
    }    
    

    Winforms Designer: Modify (and keep) properties in sub objects
    Thanks Hans!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following ViewModel property: private string _slowProperty; public string SlowProperty { get {
consider the following class and struct public class Entity { public IdType Id {get;set;}
Consider custom network protocol. This custom protocol could be used to control robotic peripherals
Say you're developing a custom control and there's a key template part that your
Consider this container: public class ItemInfo : DependencyObject { public string Name { get;
Consider a custom UIComponent (for test purposes only): public class UITest extends UIComponentBase {
Consider a class that has some events. This event list is going to grow.
Consider a view with a custom background that is drawn in drawRect: . If
Consider the following Generic class: public class Custom<T> where T : string { }
Is it possible to have nested set capabilities in this somewhat custom setup? Consider

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.