Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select file and start in specific directory VFP 9 2

Status
Not open for further replies.

taterday

Programmer
Jan 28, 2009
183
US
I want to set a directory for the user to select a file. The getfile allows them to select a file but uses the program directory for file location. I know the getdir() allows you to point to a directory but not retrieve a file. Are there any function that combines both?

Thank you
 
Code:
LOCFILE("d:\Startolder\Test.TXT")

But be careful though. If the file exists in current VFP path the dialog wouldn't be opened.


Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
I didn't do a good explaination(as anyone can tell you that has helped me.)

I allow the user to name the file and put it anywhere they want. My only required is that it be a text file. I don't know the name of the file or where it is. They have to select it for the apps.
 
you simply CD to a directy, and afterwards GetFile("txt") will start displaying .txt files of that directory.

Bye, Olaf.
 
Doesn't changing your default directory cause other problems? "CD" mean?

Thank you,
 
What problems are you having?

You can always CD back afterwards, eg CD (Justpath(Sys(16,0)))

Bye, Olaf.
 
thank you. I figured it out. I needed to use the flag for files.

Worked great.

I appreciate the response.

 
BE CAREFUL with Locfile()! It alters the VFP search path:

?set("path")
?locfile("whatever.txt")
?set("path") && new directory added to search path

Getfile() is a much better choice *unless* you want the new directory added to the search path.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top