954,558 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

File Saving / Reading - Non Constant Folder? Help needed

Hello,

I have a dilema. Currently if i want to save a file / read from a file i assign a string variable to a directory for example C:/Files/Blah.txt . However, i am currently working on a program which will be distributed between some close friends and having a fixed location for a file is absolutely no use to me whatsoever. My question is, is there a way so that when a form loads i can get it to search for the programs directory and then assign the variable as /Files/Blah.txt for example? So for example if my program was in C:/Programs it would be C:/Programs/Files/Blah.txt , and if it was in C:/Test it would be in C:/Test/Files/Blah.txt ?

Any Help on this matter would be appreciated. I have searched for possible ways to do it, but have come up with nothing.

Thanks in Advance

Best Regards

JCD

JCD
Newbie Poster
5 posts since Apr 2004
Reputation Points: 10
Solved Threads: 0
 

Just a point; The searching would be rather cumbersome, and unless Index Services are enable on the other systems.....extremely cumbersome.

:cool:

Why not use the standard FileOpenSave dialog ? Is a built in Windows/VB functionality. Or am I misinterpreting your question? :confused:

Paladine
Master Poster
Team Colleague
824 posts since Feb 2003
Reputation Points: 211
Solved Threads: 27
 

You were misinterpreting my question. I have solved the problem myself quite recently, with help from a friend. I never knew that i could just use app.path , until yesterday. I have been messing about trying far more complex things which now i see was quite pointless. Before i had my variables for the files set as for example:

UserFile = "C:\Files\ProgFile.txt"

which of course wouldn't work on other systems. However i have now solved my own problem and corrected it to read

UserFile = "" & App.Path & "\Files\UserFile.txt"

Thanks for the Help anyway

Regards

JCD

JCD
Newbie Poster
5 posts since Apr 2004
Reputation Points: 10
Solved Threads: 0
 

My apologies JCD, it was 2:30am when I read this thread. :D But glad you worked it out.

Happy Coding! :cool:

Paladine
Master Poster
Team Colleague
824 posts since Feb 2003
Reputation Points: 211
Solved Threads: 27
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You