Results 1 to 3 of 3

Thread: ProgressBar for *Multiple* Files ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    UK
    Posts
    78

    Exclamation

    I've seen hundreds of ProgressBar examples but they all deal with 1 file or 1 whatever.

    How do I do it for more:

    Example: I already have a progress bar working with one file, I now want a second progress bar for all ( a global one), which would be doing total for 5 files if I were copying them.

    I can't quite get my head around it......
    Anyone ?

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    'assuming you know how to move the files and can
    'change the code accordingly

    'with this example I list 269 files in a listbox
    'and use the progress bar to measure it's progress

    Option Explicit

    Private Sub Command1_Click()

    'get the count of files in the foler used

    Dim sCount As Integer
    Dim FSO As Object
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set FSO = FSO.GetFolder("C:\wayne vb programs\tips2 pgm\vbcode\")
    sCount = FSO.Files.Count

    Dim Counter As Integer
    ProgressBar1.Visible = True

    'Set the Progress's Value to Min.
    ProgressBar1.Value = ProgressBar1.Min
    'set the max for the progress bar
    ProgressBar1.Max = sCount

    Dim stFile As String
    Dim stDir As String

    stDir = "C:\wayne vb programs\tips2 pgm\vbcode\"
    stFile = Dir$(stDir & "*.*")

    For Counter = 1 To sCount
    List1.AddItem stFile
    stFile = Dir
    ProgressBar1.Value = Counter
    Next Counter

    End Sub

    Private Sub Form_Load()
    ProgressBar1.Align = vbAlignTop
    ProgressBar1.Visible = False

    End Sub

    [/code]
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Guest
    ...assuming all the files are the same size!

    to do it by the total number of bytes, all you need to do is add all the lengths together and take a percentage of how many bytes have been copied already. Thats the tricky part, however!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width