Alternative to List Prompt Files Option in .SCX

Last reviewed: April 29, 1996
Article ID: Q94342
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0
  • Microsoft FoxPro for Windows, versions 2.5x, 2.6x
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6x

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)" (without the quotation marks) 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.


Additional reference words: VFoxWin FoxDos FoxWin 2.00 2.50 2.50a 2.50b
2.60 2.60a 3.00
KBCategory: kbtool kbprg
KBSubcategory: FxtoolFormdes


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 29, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.