Results 1 to 2 of 2

Thread: how to load array with a directory of images?

  1. #1
    Guest
    i would like to choose a directory of images
    and then have my program show them one after
    the other, kind of like a slideshow..

    the part i haven't figured out is to load the
    images into an array from a chosen directory.

    all help appreciated in advance,
    thankx

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Ok here you go. All you need to do is have a loop using the Dir function.

    Code:
    Dim strPicArray() As String
    
    Private Sub getPics2()
        Dim strFile As String
        Dim lCount As Long
        
        'get a file back from Dir, if there is one.
        'You can change the *.* to *.bmp or whatever to
        'only return picture files
        strFile = Dir$("*.*")
        
        'while we have a file
        Do While strFile <> ""
          'redim the array
          ReDim Preserve strPicArray(lCount) As String
          strPicArray(lCount) = strFile
          lCount = lCount + 1
          #ask for the next file from Dir
          strFile = Dir
        Loop
        
    End Sub
    Iain, thats with an i by the way!

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