beginner question about a progress bar

S

Samantha

Hi.

hi have a custom created smooth progress bar (Pbar)
control and i wanted to know how i can reset the bar to 0
after the bar has run to completion.

The pbar uses a timer control to function
The code that i have been given in an example is:

'this is added to the tick event for the timer
If (Me.SmoothProgressBar1.Value > 0) Then
Me.SmoothProgressBar1.Value -= 1
Me.SmoothProgressBar2.Value += 1
Else
Me.Timer1.Enabled = False
End If

'this is added to the onclick event on a button:
Me.SmoothProgressBar1.Value = 100
Me.SmoothProgressBar2.Value = 0

Me.Timer1.Interval = 1
Me.Timer1.Enabled = True

at present this code runs 2 progress bars on the form.
one runs backwards, while the other goes forward.
I need help on modifying this to just use one pbar that
goes forward and then resets itself once it has completed.

Can anyone help me.


thx for your help
 
H

Herfried K. Wagner [MVP]

* "Samantha said:
hi have a custom created smooth progress bar (Pbar)
control and i wanted to know how i can reset the bar to 0
after the bar has run to completion.

The pbar uses a timer control to function
The code that i have been given in an example is:

See inline comments.

\\\
'this is added to the tick event for the timer
If Me.SmoothProgressBar1.Value = 100 Then
Me.SmoothProgressBar1.Value = 0
Me.Timer1.Enabled = False
Else
Me.SmoothProgressBar1.Value += 1
End If
///
 
T

Tom Leylan

Samantha said:
The pbar uses a timer control to function
The code that i have been given in an example is:

Samantha... I hate to throw a monkey wrench into this but consider that your
progress bar isn't really marking "progress" but rather the passage of time.

You could set up an endless loop and your timer interrupt would smoothly
move the bar but nothing is really being done. Resetting it to zero will
make it start over but it will never be finished. Progress indicators
should have a direct tie to whatever it is monitoring. If it was
downloading a file (for instance) 100% would be the total file size and it
could update each time 1% more data showed up. Similarly if it was
processing a database table the total number of rows to process would be
displayed and it could "tick" each time a row was processed.

Tom
 
S

Samantha

Hi Herfried,

I used the code u gave me and it works great. The only
problem i have encountered now is that this code for the
onclick event that runs the progress bar does not run
before the new form is loaded. What should i write for
the onclick event that would change this?? once the new
form has opened i want the old form to close.

currently i have the following under the onclick event:

Me.Timer1.Interval = 1
Me.Timer1.Enabled = True
Dim frmRes As New frmRes()
frmRes.Show()

what could i change to make it work?
once again, thank u so much for your help. :blush:)
 
H

Herfried K. Wagner [MVP]

* "Samantha said:
I used the code u gave me and it works great. The only
problem i have encountered now is that this code for the
onclick event that runs the progress bar does not run
before the new form is loaded. What should i write for
the onclick event that would change this?? once the new
form has opened i want the old form to close.

currently i have the following under the onclick event:

Me.Timer1.Interval = 1
Me.Timer1.Enabled = True
Dim frmRes As New frmRes()
frmRes.Show()

I don't understand why you use the progressbar + timer. Which progress
should it visualize?

If you want to unload/load forms, one after the other, have a look here:

<http://groups.google.com/groups?selm=u#[email protected]>
 
S

Samantha

Hi,

i am not trying to visulise any progress. I am building a
prototype so i just need it to look as if it is
monitoring progress. I do not know the first thing about
programming and am just starting to learn. This is the
first language i have tried so am struggling big
time!! :blush:)
As this is a custom built control, i cant find any
resources on how i can manipulate it so i applogise for
the many questions that i have asked. This is why i am
using the timer, as this is the only resource i have
found telling me how to make it work.

Any help would be great.
thank u for your time and patience :blush:)
 
H

Herfried K. Wagner [MVP]

* "Samantha said:
i am not trying to visulise any progress. I am building a
prototype so i just need it to look as if it is
monitoring progress. I do not know the first thing about
programming and am just starting to learn. This is the
first language i have tried so am struggling big
time!! :blush:)

I remember the time when I was struggling with programming languages
too.

;-)
As this is a custom built control, i cant find any
resources on how i can manipulate it so i applogise for
the many questions that i have asked. This is why i am
using the timer, as this is the only resource i have
found telling me how to make it work.

If you have any questions, feel free to post them to this or an other
appropriate group.
 

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

Similar Threads


Top