Drive Property

See Also3OBIIXF                 Example1N1SAWT>Low

Applies To

Drive list box5WJO0PW.

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 Change8DZUNR 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 ListIndex4K7KHR property is -1.

 

Note   The Drive property returns a different value from the ListIndex, which returns the list box selection.

 

Data Type

String7WSH0XQ


See Also

Help:

FileName PropertyJHVBZJ

Path PropertyBKGP79

PathChange Event3811T7

Pattern PropertyXYKZRG

PatternChange Event2JU7UW9

 

Programmer's Guide:

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.
End Sub
Sub Dir1_Change ()
  File1.Path = Dir1.Path     ' When Dir changes, set File path.
End Sub