title: Struggling to get ProgressBar updated (without threading)
body: <p>i have a program(winform) that runs through a lot of files(in the area of 400 some times) in a folder and to show its progressing i use a progress bar. the info get posted into a listview if that makes a difference.  The problem i am having is that when the pc is slow, im working with folders over a network or if it is a really big amount of files the ProgressBar just stops updating. if n leave the program it will continue and finish, but the progress bar gets stuck at some stage. And then only shows that it is complete (additional note: i have noticed that isnt just the progress bar. sometimes it is the whole form. but again, when the program is done it is fine. and while it is working you can move the form, just not interact with it)</p>
  
  <p>Now here is where it gets tricky. I know it can be solved by using threads. i have however been told not to use it(let us not go into the why, lets just except it, whether it is stupid or not). i have also tried to refresh the form, and to refresh the bar itself. none of it seems to work. it isn't a good idea to use it, but even tried .DoEvent, it also doesn't work</p>
  
  <p>How can i get the progress bar to update? any ideas?</p>
  
  <p>here is some of the code i use for the progress bar</p>
  
  <pre><code>//before the loop
  progress = iCount1;
  progressvalue = 0;
  double increment = 100 / (double)progress;
  //this is at the end of the loop
  progressvalue = progressvalue + increment;
  </code></pre>
  
  <p>then there is a bit of code. some of it to stop the value from going out of bound. the rest not related to the progress bar at all</p>
  
  <p>edit: o, i have that 1 variable. and it basically runs over 3 loops. so that we have one continuous bar. not the bar running 3 times</p>
  
  <p>edit: it seems to work fine for folder on my pc. but when it is run on a slow pc or over a network, that is when it does this</p>
  
  <p>EDIT:Im getting answers about backgroundworker and threads. so is there no way to do it without threads?</p>
  
  <p><strong>Update: i finally convinced my boss to do it with backgroundworker. so ill be doing it in that. but for this question i guess the .DoEvent answer is the best</strong></p>