Q: Updating a smooth progress control

G

Geoff Jones

Hi

I have been using a smooth progress control using the following link:

http://support.microsoft.com/default.aspx?scid=kb;en-us;323088#2

It works well, however I can't seem to get it to update properly.

For example, I created a test application which had the smooth progress form
and the "standard" progress control supplied with Visual Studio. I set up
the two controls to increment using the following code:

ProgressBar1.Minimum = 0
ProgressBar1.Maximum = 11
ProgressBar1.Value = 0
MySmoothProgressBar1.Minimum = 0
MySmoothProgressBar1.Maximum = 11
MySmoothProgressBar1.Value = 0

For i As Integer = 0 To 10
For j As Integer = 0 To 100000000
'Do Nothing
Next
MySmoothProgressBar1.Value += 1
ProgressBar1.Value += 1
Next

The standard progress control increments as expected. However, the smooth
progress control only updates at the end i.e. when the standard progress
control has reached its maximum.

Can anybody help with this?

Thanks in advance

Geoff
 
H

Herfried K. Wagner [MVP]

Geoff Jones said:
For i As Integer = 0 To 10
For j As Integer = 0 To 100000000
'Do Nothing
Next
MySmoothProgressBar1.Value += 1
ProgressBar1.Value += 1
Untested:

\\\
Me.ProgressBar1.Refresh()
///

Next

The standard progress control increments as expected. However, the smooth
progress control only updates at the end i.e. when the standard progress
control has reached its maximum.
 
G

Geoff Jones

Hi Herfried

Genius!!!

Thanks. That did the trick.

As a matter of interest, and in the hope that the best way to learn is to
experiment, what methods could I use to implement the same thing within the
Microsoft progress control and why doesn't the current code work? That is,
by looking at their code, I see in the "Value" function:

Me.Invalidate(updateRect)

so the code has been written to update the progress control after a value
re-assignment e.g.

SmoothProgressBar1.Value += 1

would call the "Invalidate" (which I assume is used for re-painting?).
However, it doesn't do it! Indeed, when I tried to debug the code I fount
that OnPaint was not called after this "Invalidate" (I expected it would).

Has anyone any thoughts?

Geoff
 

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