Open Multiple Files Interactively

File: ...\Samples\Solution\Controls\Lists\Multfile.scx

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)

See Also

Solutions Sample Overview | Visual FoxPro Foundation Classes A-Z