ProgressBar Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • al jones

    #1

    ProgressBar Question

    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.Collecti ons.ObjectModel .ReadOnlyCollec tion(Of String) =
    My.Computer.Fil eSystem.GetFile s(tbSource.Text , IIf(optSubdirec tories,
    FileIO.SearchOp tion.SearchAllS ubDirectories,
    FileIO.SearchOp tion.SearchTopL evelOnly))

    pbFiles.Minimum = 1
    pbFiles.Maximum = foundFiles.Coun t

    For Each foundFile As String In foundFiles
    If fpath <> System.IO.Path. GetDirectoryNam e(foundFile) Then
    fpath = System.IO.Path. GetDirectoryNam e(foundFile)
    tsStatus.Text = "Processing Folder: " & fpath
    PrintLine(intFi leNumber, "Processing Folder: " & fpath)
    End If
    << code snipped >>
    I += 1
    If I Mod 20 = 0 Then Application.DoE vents()
    pbFiles.Perform Step()
    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
  • R. MacDonald

    #2
    Re: ProgressBar Question

    Hello, Al,

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

    Cheers,
    Randy


    al jones wrote:[color=blue]
    > 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.Collecti ons.ObjectModel .ReadOnlyCollec tion(Of String) =
    > My.Computer.Fil eSystem.GetFile s(tbSource.Text , IIf(optSubdirec tories,
    > FileIO.SearchOp tion.SearchAllS ubDirectories,
    > FileIO.SearchOp tion.SearchTopL evelOnly))
    >
    > pbFiles.Minimum = 1
    > pbFiles.Maximum = foundFiles.Coun t
    >
    > For Each foundFile As String In foundFiles
    > If fpath <> System.IO.Path. GetDirectoryNam e(foundFile) Then
    > fpath = System.IO.Path. GetDirectoryNam e(foundFile)
    > tsStatus.Text = "Processing Folder: " & fpath
    > PrintLine(intFi leNumber, "Processing Folder: " & fpath)
    > End If
    > << code snipped >>
    > I += 1
    > If I Mod 20 = 0 Then Application.DoE vents()
    > pbFiles.Perform Step()
    > 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[/color]

    Comment

    • academic

      #3
      Re: ProgressBar Question

      I only used the progress bar once I believe rather then
      pbFiles.Perform Step()
      I used
      pbFiles.Value=I




      "R. MacDonald" <scitec@NO-SP-AMcips.ca> wrote in message
      news:43ee3c37$0 $50320$dbd49001 @news.wanadoo.n l...[color=blue]
      > Hello, Al,
      >
      > The default property of the Step property is 10. Try setting it to 1.
      >
      > Cheers,
      > Randy
      >
      >
      > al jones wrote:[color=green]
      >> 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.Collecti ons.ObjectModel .ReadOnlyCollec tion(Of String) =
      >> My.Computer.Fil eSystem.GetFile s(tbSource.Text , IIf(optSubdirec tories,
      >> FileIO.SearchOp tion.SearchAllS ubDirectories,
      >> FileIO.SearchOp tion.SearchTopL evelOnly))
      >>
      >> pbFiles.Minimum = 1
      >> pbFiles.Maximum = foundFiles.Coun t
      >>
      >> For Each foundFile As String In foundFiles
      >> If fpath <> System.IO.Path. GetDirectoryNam e(foundFile) Then
      >> fpath = System.IO.Path. GetDirectoryNam e(foundFile)
      >> tsStatus.Text = "Processing Folder: " & fpath
      >> PrintLine(intFi leNumber, "Processing Folder: " & fpath)
      >> End If
      >> << code snipped >>
      >> I += 1
      >> If I Mod 20 = 0 Then Application.DoE vents()
      >> pbFiles.Perform Step()
      >> 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[/color][/color]


      Comment

      • al jones

        #4
        Re: ProgressBar Question

        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:
        [color=blue]
        > I only used the progress bar once I believe rather then
        > pbFiles.Perform Step()
        > I used
        > pbFiles.Value=I
        >
        >
        >
        >
        > "R. MacDonald" <scitec@NO-SP-AMcips.ca> wrote in message
        > news:43ee3c37$0 $50320$dbd49001 @news.wanadoo.n l...[color=green]
        >> Hello, Al,
        >>
        >> The default property of the Step property is 10. Try setting it to 1.
        >>
        >> Cheers,
        >> Randy
        >>
        >>
        >> al jones wrote:[color=darkred]
        >>> 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.Collecti ons.ObjectModel .ReadOnlyCollec tion(Of String) =
        >>> My.Computer.Fil eSystem.GetFile s(tbSource.Text , IIf(optSubdirec tories,
        >>> FileIO.SearchOp tion.SearchAllS ubDirectories,
        >>> FileIO.SearchOp tion.SearchTopL evelOnly))
        >>>
        >>> pbFiles.Minimum = 1
        >>> pbFiles.Maximum = foundFiles.Coun t
        >>>
        >>> For Each foundFile As String In foundFiles
        >>> If fpath <> System.IO.Path. GetDirectoryNam e(foundFile) Then
        >>> fpath = System.IO.Path. GetDirectoryNam e(foundFile)
        >>> tsStatus.Text = "Processing Folder: " & fpath
        >>> PrintLine(intFi leNumber, "Processing Folder: " & fpath)
        >>> End If
        >>> << code snipped >>
        >>> I += 1
        >>> If I Mod 20 = 0 Then Application.DoE vents()
        >>> pbFiles.Perform Step()
        >>> 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[/color][/color][/color]

        Comment

        Working...