470,613 Members | 1,721 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,613 developers. It's quick & easy.

beginner question about a progress bar

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

Nov 20 '05 #1
6 6306
* "Samantha" <an*******@discussions.microsoft.com> scripsit:
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
///
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.


--
Herfried K. Wagner
MVP ∑ VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
"Samantha" <an*******@discussions.microsoft.com> wrote...
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
Nov 20 '05 #3
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. :o)
-----Original Message-----
* "Samantha" <an*******@discussions.microsoft.com> scripsit:
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
///
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.
--
Herfried K. Wagner
MVP ∑ VB Classic, VB.NET
<http://www.mvps.org/dotnet>
.

Nov 20 '05 #4
* "Samantha" <an*******@discussions.microsoft.com> scripsit:
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%23xQOutWDHA.2100%40TK2MSFTNGP11.phx. gbl>

--
Herfried K. Wagner
MVP ∑ VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
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!! :o)
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 :o)

-----Original Message-----
* "Samantha" <an*******@discussions.microsoft.com> scripsit:
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 progressshould it visualize?

If you want to unload/load forms, one after the other, have a look here:
<http://groups.google.com/groups?selm...QOutWDHA.2100% 40TK2MSFTNGP11.phx.gbl>
--
Herfried K. Wagner
MVP ∑ VB Classic, VB.NET
<http://www.mvps.org/dotnet>
.

Nov 20 '05 #6
* "Samantha" <an*******@discussions.microsoft.com> scripsit:
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!! :o)
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.

--
Herfried K. Wagner
MVP ∑ VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Alex | last post: by
2 posts views Thread by Nikolay Petrov | last post: by
1 post views Thread by GS | last post: by
5 posts views Thread by Aggelos | last post: by
6 posts views Thread by kimiraikkonen | last post: by
22 posts views Thread by ddg_linux | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.