When I start my program in VFP I would like it to automatically scan the contents of a specific folder and if any files in there, load them into a ListBox. Any suggestions would be appreciated. Thanks.
Is their any reason rowsourcetype 7 (files) won't do the job?
Files Source Type
You can populate a list box or combo box with the names of files from the current directory. The list also contains options for you to choose a different drive and directory to display file names from.
To populate the control with file names from a directory
Set RowSourceType to 7 (Files).
Set RowSource by specifying a file skeleton or mask, such as *.* or *.fileExt.
For example, the following lines of code set RowSourceType to 7 to indicate that the source type is files and specifies a file skeleton for RowSource:
I didn't suggest using RowSourceType = 7, mainly because I don't like the way the files appear in the listbox with this RowSourceType. It looks a bit DOS-like, if you know what I mean. In particular, users might now know that [..] means the parent directory.
But that's just a personal preference. Your suggestion has the advantage of letting the user navigate the directory tree. Then again, if that was a requirement, it would be more Windows-like to use a File Open dialogue perhaps.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.