title: progressbar won't update with backgroundworker?
body: <p>im making file transfer (Server-Client) TCP<Br>
  i've already looked for same questions like this one .. but no answer worked for me .. </p>
  
  <p>ProgressBar doesn't update with backgroundworker .. i've searched for tutorials to do this .. and i exactly followed the steps.<Br>
  the form lags while sending and after the file sent.. the progressbar goes to 100%<br></p>
  
  <p>The file sent succesfully the send method code works fine... my problem just with updating the progressbar .. how do i fix that ??</p>
  
  <p>Here i call (<B>backgroundWorker1.RunWorkerAsync</b>)</p>
  
  <pre><code>public void Send(string destPath)
      {
          if (listView1.Items.Count &gt; 0)
          {
              List&lt;String&gt; job = new List&lt;string&gt;();
              job.Add(listView1.Items[0].ToolTipText);
              job.Add(destPath);
              backgroundWorker1.RunWorkerAsync(job);
          }
      }
  </code></pre>
  
  <p><b>DoWork Method</b></p>
  
  <pre><code>private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
      {
          List&lt;string&gt; job = (List&lt;string&gt;)e.Argument;
          SendFile(job[0],job[1]);
      }
  </code></pre>
  
  <p>here's the SEND method which i use (<b>backgroundWorker1.ReportProgress</b>) </p>
  
  <pre><code>private void SendFile(string srcPath, string destPath)
      {
          string dest = Path.Combine(destPath, Path.GetFileName(srcPath));
          using (fs = new FileStream(srcPath, FileMode.Open, FileAccess.Read))
          {
              try
              {
                  long fileSize = fs.Length;
                  sizeAll = fileSize;
                  long sum = 0;
                  int count = 0;
                  data = new byte[fs.Length];
                  SendCommand("receive&lt;" + dest + "&lt;" + fs.Length.ToString());
                  while (sum &lt; fileSize)
                  {
                      if (fileSize - sum &lt; packetSize)
                      {
                          count = fs.Read(data, 0, (int)(fileSize - sum));
                          network.Write(data, 0, (int)(fileSize - sum));
                      }
                      else
                      {
                          count = fs.Read(data, 0, data.Length);
                          network.Write(data, 0, data.Length);
                      }
                      fs.Seek(sum, SeekOrigin.Begin);
                      sum += count;
                      sumAll += count;
                      backgroundWorker1.ReportProgress((int)((sum * 100) / fileSize));
                  }
                  network.Flush();
              }
              finally
              {
                  CloseTransfer();
              }
          }
      }
  </code></pre>
  
  <p>and here is <b>backgroundWorker1_ProgressChanged</b></p>
  
  <pre><code>private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
      {
          progressBarFile.Value= e.ProgressPercentage;
      }
  </code></pre>