DiskDrives (statement)


DiskDrives array()


Fills the specified String or Variant array with a list of valid drive letters.


The array() parameter specifies either a zero- or a one-dimensioned array of strings or variants. The array can be either dynamic or fixed.

If array() is dynamic, then it will be redimensioned to exactly hold the new number of elements. If there are no elements, then the array will be redimensioned to contain no dimensions. You can use the LBound, UBound, and ArrayDims functions to determine the number and size of the new array's dimensions.

If the array is fixed, each array element is first erased, then the new elements are placed into the array. If there are fewer elements than will fit in the array, then the remaining elements are initialized to zero-length strings (for String arrays) or Empty (for Variant arrays). A runtime error results if the array is too small to hold the new elements.


This example builds and displays an array containing the first three available disk drives.

Sub Main()

  Dim drive$()
  DiskDrives drive$
  r% = SelectBox("Available Disk Drives",,drive$)
End Sub

See Also

ChDrive (statement); DiskFree (function).

More information