Click here to Skip to main content
15,887,416 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi i would like increase Progress Bar per 1 Second
my mean when progressbar Minimum is 1 and maximum is 100 , it Load in 100 second

Thank you
Posted

You could for example use Timer[^] class and it's Elapsed[^] event.

However, if you're loading something in your code, I think it would be better to show the progress based on what is executed in code rather than on predefined time which may vary on different systems/machines.
 
Share this answer
 
Comments
Amir Mahfoozi 19-Dec-11 12:16pm    
Congratulations on reaching to 60000 ;)
Wendelius 19-Dec-11 14:00pm    
Oh, thanks :)
Setup a Timer that sets the Progressbar.Value property once every second. How far the progressbar goes with each update depends on how long you want to run befor the progress bar reaches 100 percent. If you want it to reach 100% in 60 seconds, you have to perform math on the value.

VB
Dim increment As Integer = 100 / 60;
progressbar1.Value = Math.Min(100, Progressbar1.Value + increment)
 
Share this answer
 
v2
easiest way

include timer to ur form,double click the form and type:
VB
Timer1.Enabled = True

        ProgressBar1.Minimum = 0
        ProgressBar1.Maximum = 100
        ProgressBar1.Value = 0

thn double click the timer and type:
VB
If ProgressBar1.Value <= 99 Then
          ProgressBar1.Value = ProgressBar1.Value + 1
      Else
          Timer1.Stop()
          MsgBox("finished")
 
Share this answer
 
Comments
Ron Beyer 10-Jan-14 15:35pm    
This was solved over 3 years ago. Not only that, but your code creates a cross-thread exception.
Member 10274691 1-Feb-14 16:05pm    
Ron, it does not do that. I have tested it on my own machine. You did something to get it to generate that exception. If the code does generate a cross-thread exception, I haven't noticed it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900