Alternative to List Prompt Files Option in .SCX (94342)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft FoxPro for MS-DOS 2.0

This article was previously published under Q94342

SUMMARY

In the Screen Builder, selecting the Prompt Files option in the List dialog box (on the Screen menu) produces a list object of files and directories from a given path. You can select from this list as well as change to other directories or drives.

To display only a list of files in a specific directory, use the function ADIR() and the From Array option instead. Using this option also prevents you from changing to other directories or drives.

MORE INFORMATION

FoxPro 2.x for Windows

To get a list object of .DBF files in the TUTORIAL subdirectory, do the following:
  1. Open the appropriate .SCX file, and include the code below in the Setup code snippet:
          =ADIR(MYLIST,"C:\FOXPRO2\TUTORIAL\*.DBF")
  2. Place the cursor on the .SCX form. From the Screen menu, choose List, and select the From Array option. Use "MYLIST" as the array name.
  3. Assign a variable name to this list object; call it DBFLIST.
  4. From the Program menu, choose Generate.

Visual FoxPro for Windows

  1. Add a property called mylist(1) to the form.
  2. In the Load event, add the following lines of code:
          DIMENSION THISFORM.mylist(1)
          =ADIR(THISFORM.mylist,"c:\vfp\samples\data\*.dbf")
  3. For the listbox, change the RowSourceType to 5-Array, and then change the RowSource to THISFORM.mylist.
NOTE: The arguments used with the ADIR() function directly affect file searches.

For more information about the arguments used with the ADIR() function, see the version 2.0 "Commands & Functions" manual or the version 2.5 "Language Reference" manual.

Modification Type:MajorLast Reviewed:10/15/2003
Keywords:KB94342 kbAudDeveloper