Microsoft KB Archive/195409

= How To Get Full Path of Item Selected in List Box =

Article ID: 195409

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 3.0b for Macintosh

-



This article was previously published under Q195409



SUMMARY
This article shows how to obtain the full path of a file chosen in a list box or combo box control that has a RowSourceType property set to 7-Files.



MORE INFORMATION
You can use the ListItem property to obtain the path of the file selected. The ListItem property is a character string array used to access the items in a combo box or list box control by item ID. An item ID of two (2) is the full path to the directory for which files are currently being shown in the list box. An item ID of one (1) is just the drive.

The following steps create a form to illustrate these concepts:

 Create a new form. Add a list box and a command button to the form.  Set the following properties for the list box: RowSourceType=7    (for Files) RowSource=C:\*.*   (to show all files in root of C:\)   Place the following code in the Click event of the command button: WAIT WINDOW Thisform.list1.Value WAIT WINDOW Thisform.list1.ListItem(2)+Thisform.list1.Value  Save and run the form. In the list box, navigate into the directory of your choice and select a file. Click the command button. The first WAIT WINDOW displays the Value property of the list box. The second WAIT WINDOW displays the ListItem(2) value of the list box concatenated with the Value property.</li></ol>

Keywords: kbhowto kboop kbcontainer kbctrl KB195409

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.