See Also Example
Applies To
Drive list box.
Description
Determines the selected drive at run time; not available at design time.
Usage
drivelistbox.Drive[ = drivespec]
Remarks
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 FileName
Note The Drive property returns a different value from the ListIndex, which returns the list box selection.
Data Type
String
Help:
FileName Property
Path Property
PathChange Event
Pattern Property
PatternChange Event
Programmer's Guide:
Chapter 18, "Using the File-System Controls"
Chapter 19, "Processing Files"
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.
End Sub
Sub Dir1_Change ()
File1.Path = Dir1.Path ' When Dir changes, set File path.
End Sub