title: Progress Bar run less time than defined - continue previous post
body: <p>this is my post earlier: <a href="https://stackoverflow.com/questions/14575359/progress-bar-run-less-time-than-defined">Progress Bar run less time than defined</a></p>
  
  <p>all the answers was that i don't need to divide the milliseconds by 100 and when i try this solution the progress bar run to slow unlike the first time that it runs to fast but i think i need to divide the milliseconds by 100 in order to set each 1% from the total 100% that the progress should run.
  for example if i want my progress bar will run for 10 seconds so i i divide 10000 / 10 each 1%  (or timer tick) will need to be 100 milliseconds so even if i configure it to 100 it still to fast</p>
  
  <pre><code>void bittwist_progBarEventHandler(object sender, EventArgs e)
  {
      this.Invoke((MethodInvoker)delegate { AnimateProgBar((int)sender); });
  }
  
  public void AnimateProgBar(int milliSeconds)
  {
      if (!timerProgress.Enabled)
      {
          this.Invoke((MethodInvoker)delegate { pbStatus.Value = 0; });
          timerProgress.Interval = milliSeconds / 100;
          timerProgress.Enabled = true;
      }
  }
  
  private void timerProgress_Tick(object sender, EventArgs e)
  {
      if (pbStatus.Value &lt; 100)
      {
          pbStatus.Value += 1;
          pbStatus.Refresh();
      }
      else
      {
          timerProgress.Enabled = false;
      }
  }
  </code></pre>
  
  <p>for example for <code>milliSeconds == 10000</code> the progress bar runs only for 7 seconds</p>