Progress bar with percentage

veco888

Newbie
Joined
Oct 29, 2012
Messages
34
Reaction score
5
How to make a "slow" progress bar showing a percentage instead of just putting " %".
Progressbar1.Maximum = 800
...

Thanks in advance.
 
Not sure what language you are using. But you need to set the value.

ProgressBar.Value = 1;
ProgressBar.Value++;

If your program is not multithreaded you can simple use async await to update the Form
 
I need a fake downloader with progress bar showing percentage in the label. I know how to set it when value = 100, but what to do when I need to set bigger value, how to calculate percentage.

VB NET
 
public async void ProgressBar()
{
progressBar.Value=0;
for(i=0;1<100;i++)
{
progressBar.Value++;
textBlock.Text= i.ToString() + " %";
await Task.Delay(100); // wait 100ms
}
}

This should do the job. Set the delay in ms before adding 1%. Same concept should work for VB.NET
 
I need a fake downloader with progress bar showing percentage in the label. I know how to set it when value = 100, but what to do when I need to set bigger value, how to calculate percentage.

VB NET

add a timer & write code it
progressbar.value = progressbar.value + 1
if progressbar.value = 100
msgbox.show("done")
end if
 
Back
Top