Results 1 to 3 of 3

Thread: [RESOLVED] Array Q

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    Up State NY
    Posts
    525

    Resolved [RESOLVED] Array Q

    I'm on a roll here so bear with me...

    In amking an array, the array needs to be DIMMed prior to filling. Using this code I can count all the drives, but I want to put the drive letters in an array.

    <code>
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set colDrives = objFSO.Drives
    i=0
    For Each objDrive in colDrives
    i=i+1
    Next

    i=int(i)

    dim Xdrive(i)
    </code>

    when the code reaches the DIM statement, it fails saying it needs an integer. I tried to change the value from Csng to INT, but it still fails.
    Any ideas guys?

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    Up State NY
    Posts
    525

    Re: Array Q

    Ok got it. I made a dynamic array instead.

  3. #3
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: [RESOLVED] Array Q

    Code not tested.But will work
    Code:
    Dim i
    Dim drvs()  'For storing the drivename
    i=0
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set colDrives = objFSO.Drives
    For Each objDrive in colDrives
    i=i+1 
    drvs(i)=objDrive.Name 'Store the drive name
    Next
    Please mark you thread resolved using the Thread Tools as shown

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