See Also Example
Applies To
App object, directory list box
Description
Determines the current absolute path 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 Change event.
For a file list box, generates a PathChange 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
String
Help:
Archive, Hidden, Normal, System Properties
Drive Property
FileName Property
List Property
ListCount Property
ListIndex Property
PathChange Event
Pattern Property
PatternChange Event
ReadOnly Property
Programmer's Guide:
Chapter 18, "Using the File-System Controls"
Chapter 19, "Processing Files"
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