progress bar

M

martin1

All,

I try to use progress bar to show how much % done for my app run, can anyone
tell how to make code work?

Thanks,
Martin
 
R

rowe_newsgroups

All,

I try to use progress bar to show how much % done for my app run, can anyone
tell how to make code work?

Thanks,
Martin

There is a progress bar control, the problem is you must be able to
determine when a step is complete so you can update the progress bar
with the current percentage. I don't know of any "magic" control that
can automatically track a process's completion.

Thanks,

Seth Rowe [MVP]
 
K

kimiraikkonen

There is a progress bar control, the problem is you must be able to
determine when a step is complete so you can update the progress bar
with the current percentage. I don't know of any "magic" control that
can automatically track a process's completion.

Thanks,

Seth Rowe [MVP]

I also wonder an efficent way to get percentage of the process that is
done. In my opinion, progress bar is widely used with an helper
process which provides the current work's progress situation with
numerical percantage such between %0-%100. I mean;

Progressbar1.value = process.progressValue

If you don't know the exact percantage but you know how much it'll
take with a reasonable guess, you can step forward the progress bar
value by your own. In this case using timer is good for pushing value
forward automatically:

See this:

'Assume that your work will take 10 seconds
'Use a timer control for automatic increment.
'Don't forget to set timer's interval to 1000miliseconds

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
' To avoid not to move further than 100
If Not ProgressBar1.Value = 100 Then
ProgressBar1.Value = ProgressBar1.Value + 10
End If

If ProgressBar1.Value = 100 Then

' Disable timer when work is finished
Timer1.Enabled = False

'Work has been done
MsgBox("Work has been done")

End If

End Sub

In this code, progress bar will step forward with 10 block increments
and 1 second interval which will take absolute 10 secons at total.

But i know this is completely not reliable and not the aim, because
noone can know the that how long the same work will take, so as i
stated previously, it depends on your process's progress providing
capability.

Hope this helps.
 
C

Cor Ligthert[MVP]

Kimi,

You should always know the steps that can be taken.

For a progress bar you need:
The beginpoint
The steps
The endpoint

Whatever it is.

As soon as you don't know that you can better use an AVI or an Animated Gif
as you see often in Windows OS instead of some pseudo information (from
which I have often the idea that I am looking at in Vista)..

Just my idea.

Cor
 
K

kimiraikkonen

Kimi,

You should always know the steps that can be taken.

For a progress bar you need:
The beginpoint
The steps
The endpoint

Whatever it is.

As soon as you don't know that you can better use an AVI or an Animated Gif
as you see often in Windows OS instead of some pseudo information (from
which I have often the idea that I am looking at in Vista)..

Just my idea.

Cor

Cor,
Unfortunately the problem is not to know the exact end/begin points.
However in some cases you can move progress bar indicator forward, an
example i've found using for-next loop:

Dim i As Integer
For i = 0 To UBound(RandArray)
RandArray(i) = Int(Rnd() * 1000000)
TextBox1.Text = TextBox1.Text & RandArray(i) & vbCrLf
ProgressBar1.Value = i
Next i

which fills the array with random numbers and displays them in a
textbox by the time progress bar is moved forward till all the array
is filled.

More samples are welcome with progress bar :)
 
C

Cor Ligthert[MVP]

As you have Visual Studio, then there are some in the SDK, I have to search
for that, something that you can do yourself as well in my idea.

Cor
 
P

Patrice

You could also use the "marquee" display style that animate the progress bar
in loops just to show that something is going on...
 
K

kimiraikkonen

You could also use the "marquee" display style that animate the progress bar
in loops just to show that something is going on...

Marquee type just an animation if OP requires that type of indicator.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top