I need to get tables only have or start names as month1,month2.....
thisform.text1.value=getfile("month.dbf")
thisform.text1.value=getfile("month*.dbf")
As the asterisk there will be construed by VFP as part of the filename, and not as a wildcard. Same goes with LOCFILE() and PUTFILE() where you cannot also use a wild character on the filename.
Ordinarilly, the immediate thinking goes to these steps:
- Use ADIR() to gather filenames starting with the word "Month" and with extension "dbf":
- Create a cursor to hold the result and perform INSERT INTO .. FROM ARRAY laMyFiles
- Create a grid to show the result, then put some more codes either on AfterRowColChange or Click events to transfer the result into the textbox
However, while that is one of the best ways to do those, there is yet simpler way which is using the highly unutilized feature of listbox known as RowSourceType = 7. It involves less coding and actually is very easy to use. For the sake of this example, I will simply filter the list of files with all dbf: