See Also Example
Drive list box.
Determines the selected drive at run time; not available at design time.
drivelistbox.Drive[ = drivespec]
The valid range for the Drive property includes all drives present in or connected to the system when the control is created or refreshed at run time. The Drive property defaults to the current drive.
When reading this property, the selected drive is returned in one of the following formats:
Floppy disks"a:" or "b:", and so on.
Fixed media"c: [volume id]"
Network connections"x: \\server\share"
When setting this property:
Only the first character of the string is significant (the string is not case-sensitive).
Changing the setting for Drive causes a Change event.
Selecting a drive that is not present causes an error.
Setting this property also regenerates the drive list, providing a way in code to track network connections added since the control was created.
If the FileNameJHVBZJ property is set to a qualified network path without a drive designation, the value of the Drive property is an empty string (""), no drive is selected, and the ListIndex property is -1.
Note The Drive property returns a different value from the ListIndex, which returns the list box selection.
Chapter 18, "Using the File-System Controls"
Chapter 19, "Processing Files"
Drive Property Example
The example displays a list of files for the current drive and directory. To try this example, paste the code into the Declarations section of a form that contains a drive list box, a directory list box and a file list box.. Then press F5. Use the mouse to change the drive or directory.
Sub Drive1_Change ()
Dir1.Path = Drive1.Drive ' When Drive changes, set Dir path.
Sub Dir1_Change ()
File1.Path = Dir1.Path ' When Dir changes, set File path.