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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:05:26+00:00 2026-06-03T17:05:26+00:00

I am updating a timer field in my listView from different threads. It works

  • 0

I am updating a “timer” field in my listView from different threads. It works fine, the problem is just that it flickers. This is the code each thread is calling when it needs to be updated (almost every second).

    private void AddToListView(string user, string status, string proxy, int number)
    {
        Invoke(new MethodInvoker(
                       delegate
                       {

                                listView1.BeginUpdate();
                                this.listView1.Items[number].SubItems[1].Text = status;
                                listView1.EndUpdate();


                       }
                       ));
    }

Having Googled a bit im not even sure i can make this flicker go away? :/

  • 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-03T17:05:33+00:00Added an answer on June 3, 2026 at 5:05 pm

    I would not use Invoke here. In fact, in most cases it is usually not a great option despite what you may read on the internet. Instead, package up the data being generated by the thread into a POCO and put it into a queue. Have a System.Windows.Forms.Timer tick every second with the event handler pulling items out of the queue to update the ListView in batches. Also, try setting DoubleBuffered to true. These suggestions should help some.

    public class YourForm : Form
    {
      private ConcurrentQueue<UpdateInfo> queue = new ConcurrentQueue<UpdateInfo>();
    
      private void YourTimer_Tick(object sender, EventArgs args)
      {
        UpdateInfo value;
        listView1.BeginUpdate();
        while (queue.TryDequeue(out value)
        {
          this.listView1.Items[value.Number].SubItems[1].Text = value.Status;
        }
        listView1.EndUpdate();
      }
    
      private void SomeThread()
      {
        while (true)
        {
          UpdateInfo value = GetUpdateInfo();
          queue.Enqueue(value);
        }
      }
    
      private class UpdateInfo
      {
        public string User { get; set; }
        public string Status { get; set; }
        public string Proxy { get; set; }
        public int Number { get; set; }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm updating a picture by using timer, but it causes fatal performance problem. Then
After updating to Parsec 3.1 from 2.x, code using many1, such as word =
Problem: Activity A is a ListView that contains a ListAdapter , and clicking in
So I'm pretty new to Visual Basic and inherited this VB6 code that i
I am updating text field after certain time. Here is my code: ActionListener task
I have a form for updating user data. It posts to this page: <?php
I was reading this question MySQL - why not index every field? and decided
I fill a form fields (in pygtk) from a class instance that contains its
I'm currently inserting/updating fields like this (if there's a better way, please say so
I have a table in my database which is house, that has many field

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.