alec

alec

  • NA
  • 86
  • 57.6k

status output to RichTextBox during a click event

Sep 13 2011 8:41 AM
i have a form with a button whose click event sets of an algorythem that contains a loop and at the end of each itteration i want it to update the richtextbox with what percentage done it is ... sort of like this

int numberToDo = ...;

int i = 0;
int percentDone = 0;

while(i < numberToDo)
{
    //do stuff
    percentDone = (i/numberToDo)*100;
    RichTextBox.clear();
    RichTextBox.AppendText(percentDone.ToString() + "% Done");
}



but this does not update in real time it just says 100% Done once its done ... will i need multiple threads? if so how do i do it?

Answers (1)