Results 1 to 6 of 6

Thread: Loop??

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Ireland
    Posts
    224

    Question

    Can someone tell me how to write a loop to count the number of files in an array??

  2. #2
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Thumbs up Good news...

    Kanejone. You can use the Ubound Function to get the number of files without having to loop through the array.
    Code:
    lFilesCount = (Ubound(YourFilesArray) + 1)
    All the best.

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

    <?>

    you don't need a loop if they are in an array
    file count would be
    msgbox "My file count = " & uBound(myArray)-1
    'minus 1 as arrays are zero based
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600
    HeSaidJoe,
    'minus 1 as arrays are zero based
    wouldn't you need to add 1 because of this to get the file count? For example if the array contained 2 files, subtracting 1 from UBound would give a file count of 0, whereas adding 1 would give a file count of 2.

    All the best.

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

    <?>

    Your're right (Add 1)
    ..it's those cheap drugs..
    Gotta get a raise so I can get better ones.

    LOL

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

    ___ Adolf Jensen

  6. #6
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    HeSaidJoe

    Maybe you should lay off of the drugs for a while!

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