By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,163 Members | 1,275 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,163 IT Pros & Developers. It's quick & easy.

ProgressBar Question

P: n/a
I have the following, extracted from my code (sorry, the files 'line' of
code wraps across the first five lines of the copy) and pbFiles is
(obviously?) the progressbar.

Dim foundFiles As
System.Collections.ObjectModel.ReadOnlyCollection( Of String) =
My.Computer.FileSystem.GetFiles(tbSource.Text, IIf(optSubdirectories,
FileIO.SearchOption.SearchAllSubDirectories,
FileIO.SearchOption.SearchTopLevelOnly))

pbFiles.Minimum = 1
pbFiles.Maximum = foundFiles.Count

For Each foundFile As String In foundFiles
If fpath <> System.IO.Path.GetDirectoryName(foundFile) Then
fpath = System.IO.Path.GetDirectoryName(foundFile)
tsStatus.Text = "Processing Folder: " & fpath
PrintLine(intFileNumber, "Processing Folder: " & fpath)
End If
<< code snipped >>
I += 1
If I Mod 20 = 0 Then Application.DoEvents()
pbFiles.PerformStep()
Next

I'm confused - the progressbar is 'finished' long before I'm done
processing in fact it's filled when I'm about 15% of the way done. It was
my impression that since I've given it the min and max - and then call
performstep as I process each file, *IT* should be able to caluclate how
far along the progressbar is ... what is it that I'm understanding
incorrectly??

Thanks //al
Feb 11 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hello, Al,

The default property of the Step property is 10. Try setting it to 1.

Cheers,
Randy
al jones wrote:
I have the following, extracted from my code (sorry, the files 'line' of
code wraps across the first five lines of the copy) and pbFiles is
(obviously?) the progressbar.

Dim foundFiles As
System.Collections.ObjectModel.ReadOnlyCollection( Of String) =
My.Computer.FileSystem.GetFiles(tbSource.Text, IIf(optSubdirectories,
FileIO.SearchOption.SearchAllSubDirectories,
FileIO.SearchOption.SearchTopLevelOnly))

pbFiles.Minimum = 1
pbFiles.Maximum = foundFiles.Count

For Each foundFile As String In foundFiles
If fpath <> System.IO.Path.GetDirectoryName(foundFile) Then
fpath = System.IO.Path.GetDirectoryName(foundFile)
tsStatus.Text = "Processing Folder: " & fpath
PrintLine(intFileNumber, "Processing Folder: " & fpath)
End If
<< code snipped >>
I += 1
If I Mod 20 = 0 Then Application.DoEvents()
pbFiles.PerformStep()
Next

I'm confused - the progressbar is 'finished' long before I'm done
processing in fact it's filled when I'm about 15% of the way done. It was
my impression that since I've given it the min and max - and then call
performstep as I process each file, *IT* should be able to caluclate how
far along the progressbar is ... what is it that I'm understanding
incorrectly??

Thanks //al

Feb 11 '06 #2

P: n/a
I only used the progress bar once I believe rather then
pbFiles.PerformStep()
I used
pbFiles.Value=I


"R. MacDonald" <sc****@NO-SP-AMcips.ca> wrote in message
news:43***********************@news.wanadoo.nl...
Hello, Al,

The default property of the Step property is 10. Try setting it to 1.

Cheers,
Randy
al jones wrote:
I have the following, extracted from my code (sorry, the files 'line' of
code wraps across the first five lines of the copy) and pbFiles is
(obviously?) the progressbar.

Dim foundFiles As
System.Collections.ObjectModel.ReadOnlyCollection( Of String) =
My.Computer.FileSystem.GetFiles(tbSource.Text, IIf(optSubdirectories,
FileIO.SearchOption.SearchAllSubDirectories,
FileIO.SearchOption.SearchTopLevelOnly))

pbFiles.Minimum = 1
pbFiles.Maximum = foundFiles.Count

For Each foundFile As String In foundFiles
If fpath <> System.IO.Path.GetDirectoryName(foundFile) Then
fpath = System.IO.Path.GetDirectoryName(foundFile)
tsStatus.Text = "Processing Folder: " & fpath
PrintLine(intFileNumber, "Processing Folder: " & fpath)
End If
<< code snipped >>
I += 1
If I Mod 20 = 0 Then Application.DoEvents()
pbFiles.PerformStep()
Next

I'm confused - the progressbar is 'finished' long before I'm done
processing in fact it's filled when I'm about 15% of the way done. It
was
my impression that since I've given it the min and max - and then call
performstep as I process each file, *IT* should be able to caluclate how
far along the progressbar is ... what is it that I'm understanding
incorrectly??

Thanks //al

Feb 12 '06 #3

P: n/a
Thank you both, yes, the way I did it was to assigne the value as
pbFiles.value += 1
which works the way I expected - just didn't see it before, thanks //al

On Sun, 12 Feb 2006 14:04:27 -0500, academic wrote:
I only used the progress bar once I believe rather then
pbFiles.PerformStep()
I used
pbFiles.Value=I


"R. MacDonald" <sc****@NO-SP-AMcips.ca> wrote in message
news:43***********************@news.wanadoo.nl...
Hello, Al,

The default property of the Step property is 10. Try setting it to 1.

Cheers,
Randy
al jones wrote:
I have the following, extracted from my code (sorry, the files 'line' of
code wraps across the first five lines of the copy) and pbFiles is
(obviously?) the progressbar.

Dim foundFiles As
System.Collections.ObjectModel.ReadOnlyCollection( Of String) =
My.Computer.FileSystem.GetFiles(tbSource.Text, IIf(optSubdirectories,
FileIO.SearchOption.SearchAllSubDirectories,
FileIO.SearchOption.SearchTopLevelOnly))

pbFiles.Minimum = 1
pbFiles.Maximum = foundFiles.Count

For Each foundFile As String In foundFiles
If fpath <> System.IO.Path.GetDirectoryName(foundFile) Then
fpath = System.IO.Path.GetDirectoryName(foundFile)
tsStatus.Text = "Processing Folder: " & fpath
PrintLine(intFileNumber, "Processing Folder: " & fpath)
End If
<< code snipped >>
I += 1
If I Mod 20 = 0 Then Application.DoEvents()
pbFiles.PerformStep()
Next

I'm confused - the progressbar is 'finished' long before I'm done
processing in fact it's filled when I'm about 15% of the way done. It
was
my impression that since I've given it the min and max - and then call
performstep as I process each file, *IT* should be able to caluclate how
far along the progressbar is ... what is it that I'm understanding
incorrectly??

Thanks //al

Feb 13 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.