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

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:

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

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

Happy Coding! :cool:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.