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 9137503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:06:40+00:00 2026-06-17T09:06:40+00:00

I though I would post this as after spending several hours trying to work

  • 0

I though I would post this as after spending several hours trying to work it out I am getting nowhere. Firstly, I am fully aware that databinding in WinForms is not the best. That said it does work in most scenarios.

In my scenario, I have a binding source which is the master for my form. The object that is used for this binding source has a few simple properties and two binding lists as properties as well. Both this class, and the class type for the binding lists implement INotifyPropertyChanged. On my form, I have two DataGridViews for displaying the contents of the binding list properties.

This is also done through databinding at design time. I have two binding sources for each which use the main binding source as there data source and then the respective bindinglist properties as the data member.

So far, I would consider this to be fairly standard.

To update what is in these lists I have buttons to show a form that creates a new item, which I then add to the lists using BindingList.Add().

Now in code, if you debug, the items are in the lists, however, the grids are not updating.
But if I add a listbox to the form which uses just one of the list binding sources then both of the grids start refreshing as expected.

I apologise if any of this is unclear, I have tried to explain as best as I can with a confusing situation.

Any thoughts would be helpful as I really don’t want to have to use a hidden list box.

  • 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-17T09:06:41+00:00Added an answer on June 17, 2026 at 9:06 am

    This code works fine for me

    BindingList<Foo> source; // = ...
    private void Form1_Load(object sender, EventArgs e)
    {
        this.dataGridView1.DataSource = new BindingSource { DataSource = source };
        this.dataGridView2.DataSource = new BindingSource { DataSource = source, DataMember = "Children" };
    }
    
    private void button1_Click(object sender, EventArgs e)
    {
        source.Add(new Foo { X = Guid.NewGuid().ToString() });
    }
    
    private void button2_Click(object sender, EventArgs e)
    {
        source[0].Children.Add(new FooChild { Y = Guid.NewGuid().ToString() });
    }
    

    with the model

    public class Foo : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
    
        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    
        string x;
        public string X
        {
            get { return x; }
            set
            {
                x = value;
                this.NotifyPropertyChanged();
            }
        }
    
        BindingList<FooChild> children;
        public BindingList<FooChild> Children
        {
            get { return children; }
            set
            {
                children = value;
                this.NotifyPropertyChanged();
            }
        }
    }
    
    public class FooChild : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
    
        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    
        string y;
        public string Y
        {
            get { return y; }
            set
            {
                y = value;
                this.NotifyPropertyChanged();
            }
        }
    }
    

    Both grids get refreshed.

    I hope this helps you

    Edit

    I changed the Form1_Load impl

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

Sidebar

Related Questions

I thought I would post this here not so much as a question but
Im very new to all coding including jquery. I though this would have been
I'm trying to do something which I figure would be rather easy, though I'm
OK I keep getting this error after about 3-4 minutes of churning: Timeout expired.
Ok so after having re-read over my previous post asking for help on this
After Jeph most recent post: http://www.codinghorror.com/blog/archives/001310.html , I thought to myself it would be
I need to write some code that would loop though all rows of a
One would expect that even though strings are immutable, value-equality and reference-equality would not
I would like to read Rails documentation locally though gem server. I go to
I would like to use GDB to step though the C++ code that makes

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.