title: How to make a listview update in real time in C#
body: <p>I have an app that crawls a network looking for movies, their titles, length and last accessed time. Since there are a lot of computers on the network, this can take awhile and I would like to update my listview in real time. Heres what I have so far but its not working at all.</p>
  
  <pre><code>        private void PopulateListView()
      {
          this.listView1.SuspendLayout();
  
          listView1.Items.Clear(); 
  
          // go thru list of movies to add
          foreach (string movie in listviewMovieList)
          {
              ListViewItem item1 = new ListViewItem(movie);
              listView1.Items.AddRange(new ListViewItem[] { item1 });
  
          }
          this.listView1.ResumeLayout();            
      }
  </code></pre>
  
  <p>This gets called by my background workers ProgressChanged method:</p>
  
  <pre><code>        private void bw_ProgressChanged(object sender, ProgressChangedEventArgs e)
      {
          string movie = (string)e.UserState;            
  
          if (movie != null)
          {
              listviewMovieList.Add(movie);
              PopulateListView();
  
          }
  
          this.progressBar1.Increment(e.ProgressPercentage);            
      }
  </code></pre>