halu thanks for the reply..Michaelk said:I know how to run a progess bar based on a timer. But not sure about load times. Let me know if thats what your after.
[size=2]
[/size][size=2][color=#008000]' Connect the Tick event of the timer to its event handler.[/color][/size]
[size=2][color=#0000ff]AddHandler[/color][/size][size=2] time.Tick, [/size][size=2][color=#0000ff]AddressOf[/color][/size][size=2] IncreaseProgressBar[/size]
[size=2][color=#008000]' Start the timer.[/color][/size]
[size=2]time.Start()
[/size]
[size=2]
[/size][size=2][color=#0000ff]Private[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size][size=2] InitializeMyTimer()[/size]
[size=2][color=#008000]' Set the interval for the timer.[/color][/size]
[size=2]time.Interval = 100
[/size][size=2][color=#008000]' Connect the Tick event of the timer to its event handler.[/color][/size]
[size=2][color=#0000ff]AddHandler[/color][/size][size=2] time.Tick, [/size][size=2][color=#0000ff]AddressOf[/color][/size][size=2] IncreaseProgressBar[/size]
[size=2][color=#008000]' Start the timer.[/color][/size]
[size=2]time.Start()
[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub
[/color][/size]
[size=2]
[/size][size=2][color=#0000ff]Private[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size][size=2] IncreaseProgressBar([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]Object[/color][/size][size=2], [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] EventArgs)[/size]
[size=2][color=#008000]' Increment the value of the ProgressBar a value of one each time.[/color][/size]
[size=2]ProgressBar1.Increment(1)
[/size][size=2][color=#008000]' Display the textual value of the ProgressBar in the StatusBar control's first panel.[/color][/size]
[size=2]statusBarPanel1.Text = ProgressBar1.Value.ToString() + "% Completed"
[/size][size=2][color=#008000]' Determine if we have completed by comparing the value of the Value property to the Maximum value.[/color][/size]
[size=2][color=#0000ff]If[/color][/size][size=2] ProgressBar1.Value = ProgressBar1.Maximum [/size][size=2][color=#0000ff]Then[/color][/size]
[size=2][color=#008000]' Stop the timer.[/color][/size]
[size=2]time.Stop()
[/size][size=2][color=#0000ff][size=2][color=#008000]'Put what you want to run after the progess bar is finished here.
[/color][/size][/color][/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]If[/color][/size]
[size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size]
Private Sub initializetimer()
Timer1.Interval = 100
AddHandler Timer1.Tick, AddressOf increaseprogress
Timer1.Start()
End Sub
Private Sub increaseprogress(ByVal sender As Object, ByVal e As EventArgs)
ProgressBar1.Increment(1)
StatusBarpanel1.Text = ProgressBar1.Value.ToString() + "%completed"
If ProgressBar1.Minimum = ProgressBar1.Maximum Then
Timer1.Stop()
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
AddHandler Timer1.Tick, AddressOf increaseprogress
End Sub
Opps, i think it may because of that line of code. That line makes a statusbar display the percentage of the progress bar. Try removing it.lOnEr said:StatusBarpanel1.Text = ProgressBar1.Value.ToString() + "%completed"
halu Paszt thanks in advance...Paszt said:If you could elaborate more on what you're trying to show the progress of, I'll be glad to attempt to help.
Generally the progress bar is used to show the progress of something (obvious, I know). You would calculate the percent complete of whatever function you're doing and set the progressBar.Value property accordingly.
In your code above you have the line 'If ProgressBar1.Minimum = ProgressBar1.Maximum Then'. The Minimum value will not usually ever equal the Maximum Value (the progressBar would serve no purpose if they were equal, though it is possible). The timer should never stop.
lOnEr said:halu Paszt thanks in advance...
heres what i want..
i want to run a progressbar as well as status bar in app's by clicking a button..
im very new in this thing.
tanx and more power.
Public Sub progress()
StatusBar1.Text = "connecting to the database"
If ProgressBar1.Value = ProgressBar1.Maximum Then
ProgressBar1.Value = ProgressBar1.Maximum
End If
Dim i As Integer
For i = ProgressBar1.Minimum To ProgressBar1.Maximum
ProgressBar1.PerformStep()
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
progress()
End Sub
hi..mzim thanks..it really works..mzim said:set the progressbar1.maximum to 10000 and progressbar1.minimum to 1VB.NET:Public Sub progress() StatusBar1.Text = "connecting to the database" If ProgressBar1.Value = ProgressBar1.Maximum Then ProgressBar1.Value = ProgressBar1.Maximum End If Dim i As Integer For i = ProgressBar1.Minimum To ProgressBar1.Maximum ProgressBar1.PerformStep() Next End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click progress() End Sub
hope it helps..
happy coding