public void UpdatePercentage() { int percentage; General maths = new General(); do { Thread.Sleep(2); } while (comparison.numberOfShapes == 0); do { Thread.Sleep(7); percentage = maths.CalcualtePercentage(comparison.indexOfList, comparison.numberOfShapes); lblCompleted.Text = String.Format("Completed: {0}%", percentage); lblShapes.Text = String.Format("Shapes Processed: {0} / {1}", comparison.indexOfList, comparison.numberOfShapes); progressBar1.Value = percentage; lblCompleted.Refresh(); lblShapes.Refresh(); } while (progressBar1.Value != 100); Thread.Sleep(1500); comparison.numberOfShapes = 0; this.Close(); }