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

  • SEARCH
  • Home
  • 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 9027997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:52:49+00:00 2026-06-16T06:52:49+00:00

I have a C# WinForms app that contains a BindingList which is populated with

  • 0

I have a C# WinForms app that contains a BindingList which is populated with widget objects like this:

BindingList<Widget> widgetsList = new BindingList<Widget>();

A widget has three properties (one int, one string and one bool) and implements INotifyPropertyChanged. The widgets get added to the BindingList like this:

for (int i = 0; i < 100000; i++) // takes < 1/10 of a second to execute
{
   widgetsList.Add(new Widget(intValue, stringValue, boolValue));
}

And finally, I set the BindingList as the data source for a DataGridView (actually three DataGridView controls):

dataGridView1.DataSource = widgetsList;

This code is working well. However, if my user makes changes in the DataGridView and then wants to discard those changes and re-load the original data, I’m having issues. Right now I have a button to do this and the code in the button’s Click event handler looks like this:

dataGridView1.Rows.Clear() // very fast

widgetsList.Clear() // also very fast

    for (int i = 0; i < 100000; i++) // takes 18.6 seconds to execute
    {
       widgetsList.Add(new Widget(intValue, stringValue, boolValue));
    }

As you can see, this loop executes substantially slower (18.6s vs < .1s) than the same loop above. It does appear to work but I’m trying to figure where the bottleneck is and how to remove it. Am I missing something?

  • 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-16T06:52:50+00:00Added an answer on June 16, 2026 at 6:52 am

    Posting answer from comment above: You need to add a BindingSource between the grid and the binding list. This will allow you to suspendbinding while reloading the source list and allow the grid to hold off rendering until the datasource is fully updated.

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

Sidebar

Related Questions

I have a Winforms app that has a DataGridView that is databound at runtime.
I have a DataGridView in a Winforms app that has about 1000 rows (unbound)
Please advise me. Winforms app, C#. I have a user control (UC) that contains
i have a c# winform app that contains a listview control. i would like
Currently I have a Winforms app which relies on transpareny effects. However this is
In my winforms app, I have a list view control that is populated with
I have a WinForms app that contains several comboboxes, numericupdown controls and checkboxes. I
I have a WinForms app that contains many NumericUpDown controls. In a nutshell, if
I have a .Net4 WinForms app that references 3rd party .Net2 assemblies, which contain
We have a WinForms app that runs fine on x86, but has many third-party

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.