This sample shows how to populate a list with files. When you populate a list with files, built-in functionality makes it possible for a user to select new drives and directories. In this sample, a user can select one or more files in the list and open them for editing.
The following code loops through the items in the list box and opens the selected files for editing:
FOR nFile = 5 to THISFORM.lstFiles.ListCount IF THISFORM.lstFiles.Selected(nFile) MODIFY FILE (THISFORM.lstFiles.List(2) + ; THISFORM.lstFiles.List(nFile)) NOWAIT ENDIF ENDFOR
When the RowSourceType property is set to 7 - Files:
lstFiles.List(1) refers to the drive.
lstFiles.List(2) refers to the path.
lstFiles.List(3) is a separator line.
lstFiles.List(4) is [..]. Click to go to the parent directory.
Files can start at lstFiles.List(5)
Other ResourcesControls Solution Samples
Add Items Interactively to a List Box Sample
Display Multiple Columns in a List Box Sample
Display Pictures in a List Sample
Fill a List with Values from Different Sources Sample
Move Items Between List Boxes Sample
Multiselect Items in a List Box Sample
Sort List Box Items Sample
Treeview/ListBox Drag and Drop Sample