Path Property

See Also7P578X2                 Example2JCDUX8>Low

Applies To

App object5QU20R2, directory list boxO9U5A0, file list box1M6S8UX.

Description

Determines the current absolute path1DDXNK6, including the drive name.  Not available at design time.  For the App object, read-only at run time.

Usage

[form.]{ dirlistbox|filelistbox}.Path[ = spec ]

App.Path

Setting

The value of the Path property is a string indicating a path, such as "C:\VB" or "C:\WINDOWS\SYSTEM."  For a directory list box or a file list box, the default is the current path when the control is created at run time.  For the App object, Path specifies the absolute path of the project when running the application from the development environment, and the absolute path of the .EXE file when running the application as an executable file.

Remarks

Use this property when building an application's file-browsing and manipulation capabilities.  Setting the Path property has effects on the control similar to the MS-DOS chdir commandrelative paths are allowed with or without a drive.  Setting only a drive (with colon) selects the current directory on that drive.

This property can also be set to a qualified network path without a drive connection using the following syntax:

\\servername\sharename\path

which changes the Drive property to an empty string ("").

Changing the value of Path has these effects:

         For a directory list box, generates a Change8DZUNR event.

         For a file list box, generates a PathChange3811T7 event.

 

 

Note   For a directory list box, the return value of Path is different from that of List(ListIndex), which returns only the selection.

 

Data Type

String7WSH0XQ


See Also

Help:

Archive, Hidden, Normal, System PropertiesVNIBPL

Drive PropertyYLV8AS

FileName PropertyJHVBZJ

List PropertyBKCX6E

ListCount Property4E91QN

ListIndex Property4K7KHR

PathChange Event3811T7

Pattern PropertyXYKZRG

PatternChange Event2JU7UW9

ReadOnly Property2JZQLX0

 

Programmer's Guide:

Chapter 18, "Using the File-System Controls"

Chapter 19, "Processing Files"


Path Property Example

The example displays a list of files for the selected 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   ' Set Dir path.
End Sub
Sub Dir1_Change ()
  File1.Path = Dir1.Path     ' Set File path.
End Sub