C# answer: Create a method to finish and update the progress bar:
public async Task<bool> DoProgressbarFinishStep()
{
myProgress.progressBar1.Value = myProgress.progressBar1.Maximum;
await Task.Delay(5000);
return true;
}
then when your other routine is finished doing its loop, call the method:
bool result = await DoProgressbarFinishStep();
The ProgressBar control will then update correctly to 100% during those 5000 milliseconds (or whatever time works for you).
From what I can tell, the ProgressBar appears to exhibit this behaviour on purpose, and needs asynchronous programming to work well. Let's face it, if you are performing such a long task that it requires a progress bar, then you should be programming asynchronously anyway to avoid locking up UI threads.
Read more (2021) at https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/