|
-
Apr 8th, 2003, 01:41 PM
#1
Thread Starter
Banned
Progress Barsss
How can I make a progress bar that works with the record set.
For instance say I sql out 10 records...and I need each block
of the progress bar to represent say what .10 so that I have the following
10 records:
.10+.10+...+.10 = 100%
So each time I loop through a record I add an additional .10 to the progress bar. Or is there an easier way to do this...I want a progress bar because im sendign data to excel so I dont want users to close the application down if it takes long...I want them to see a progress bar of whats left.
If anyone has examples or c ode please POST!!!!!

Thanks Guys!
Jon
-
Apr 8th, 2003, 01:58 PM
#2
Hyperactive Member
I think it is in the Microsoft Windows common
controls 6.0 component
VB Code:
Me.ProgressBar1.Max = (Me.Fg2.Rows - 1) * (Me.Fg2.Cols - 1)
Me.ProgressBar1.Min = 0
Me.ProgressBar1.Value = 0
For RowIndex = 1 To (Me.Fg2.Rows - 1)
For ColIndex = 1 To (Me.Fg2.Cols - 1)
Me.Fg2.Row = RowIndex
Me.Fg2.Col = ColIndex
Me.ProgressBar1.Value = Me.ProgressBar1.Value + 1
Next
Next
For the above code just increment the
progress bar Counter while looping
through your data.
-
Apr 8th, 2003, 02:07 PM
#3
Thread Starter
Banned
[QUOTE]Originally posted by jcfowl
[B]I think it is in the Microsoft Windows common
controls 6.0 component
VB Code:
Me.ProgressBar1.Max = (Me.Fg2.Rows - 1) * (Me.Fg2.Cols - 1)
Me.ProgressBar1.Min = 0
Me.ProgressBar1.Value = 0
For RowIndex = 1 To (Me.Fg2.Rows - 1)
For ColIndex = 1 To (Me.Fg2.Cols - 1)
Me.Fg2.Row = RowIndex
Me.Fg2.Col = ColIndex
Me.ProgressBar1.Value = Me.ProgressBar1.Value + 1
Next
Next
Hmm thanks for the reply...just not sure how to use this code...
for instance say im going through a loop of records
VB Code:
while Not rs.eof
'do some work
'add a little to the progress bar
rs.movenext
wend
That is how I would be using it....
Jon
-
Apr 8th, 2003, 02:19 PM
#4
Hyperactive Member
Hmm thanks for the reply...just not sure how to use this code...
for instance say im going through a loop of records
VB Code:
while Not rs.eof
'do some work
'add a little to the progress bar
rs.movenext
wend
That is how I would be using it....
Jon [/B]
VB Code:
Me.ProgressBar1.Max = rs.RecordCount
Me.ProgressBar1.Min = 0
Me.ProgressBar1.Value = 0
while Not rs.eof
'do some work
'add a little to the progress bar
rs.movenext
Me.ProgressBar1.Value = Me.ProgressBar1.Value + 1
wend
-
Apr 8th, 2003, 02:33 PM
#5
Thread Starter
Banned
I came up with it.
Your method would increment the progress bar but not correctly. Since the number of records is unknown you would have to get a record count and use it as a denominator like so:
ProgressBar1.Value = ProgressBar.Value + (100/rst.RecordCount)
This way if rst has 10 records then:
100/10=10
10 is added per record so that the last record ensures the progress bar hits 100.
Jon
-
Apr 8th, 2003, 02:43 PM
#6
Hyperactive Member
why do you want it to hit 100?
just curious.....
-
Apr 8th, 2003, 02:47 PM
#7
Thread Starter
Banned
The max value doesnt really matter...in fact it could be N
where N is some positive integer less than the maximum size allowed by the progress bar. I choose 100 cause that's the default that vb assigns to the Progress Bar.
Jon
-
Apr 8th, 2003, 02:56 PM
#8
Thread Starter
Banned
Excuse my stupidity 
Your method is just as valid...I did not notice the line with the max assigned to the record count. That is actually a less mathematical method .
Jon
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|