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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:49:51+00:00 2026-06-02T19:49:51+00:00

I have a simple test class: public partial class TEST_CLASS { public string IP

  • 0

I have a simple test class:

public partial class TEST_CLASS
{
    public string IP { get; set; }
    public int PORT { get; set; }
}

iList<TEST_CLASS> MY_CLASS = new List<TEST_CLASS>();

And I have the following code to bind the class to DGV:

        TEST_CLASS n = new TEST_CLASS();
        MY_CLASS.Add(n);


        grid_nodes.DataSource = MY_CLASS;

        Thread t = new Thread(set1);
        t.Start();

        Thread t2 = new Thread(set2);
        t2.Start();

And The threads that update the class to random values for testing purposes:

    public void set1()
    {
        while (true)
        {
            Random r = new Random();
            MY_CLASS[0].IP = r.Next(999900);
            Thread.Sleep(100);
        }
    }

    public void set2()
    {
        while (true)
        {
            Random r = new Random();
            MY_CLASS[0].PORT = r.Next(999900);
            Thread.Sleep(100);
        }
    }

The problem is that DGV is not getting updated right. I only see the updates each time a click in a cell.

I’m going to have thousands of rows and separate threads updating the MY_CLASS and I need the changes to be displayed ‘live’ on the DGV.

As far as I understand I need to call DGV.Update() each time I update my class? What would be the best way of doing this, since I’m going to have thousands of threads updating the class constantly? Thanks!

  • 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-02T19:49:53+00:00Added an answer on June 2, 2026 at 7:49 pm

    If you use BindingList instead of List, and make your TEST_CLASS implement INotifyPropertyChanged, then the grid will update itself. However you will need to ensure that only happens on the UI thread by some form of marshalling (like SynchronizationContext or grid.Invoke()).

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

Sidebar

Related Questions

I have simple controller: public class TestController : Controller { public ActionResult Test(string r)
I have a simple object like this public class Test { public string Name
I have this simple test project just to test the IncludeExceptionDetailInFaults behavior. public class
I have the following simple code abstract class A { public abstract void Test(Int32
I have a simple class I'm serializing. [DataContract(Name = Test, Namespace = )] public
I have a simple JUnit test in Eclipse. public class HelloTest extends TestCase {
I have written a simple test class for Play! 2.0: public class TestLogin {
I have simple static lib in xcode with the only class test.h: @interface TestClass
I have a simple test application (C# console application) that does an HTTP GET
I'm stuck! I have this very simple test code and I can't get it

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.