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!

OpenFile Dialog and Write

Status
Not open for further replies.

DaZZleD

Programmer
Oct 21, 2003
886
US
In my application I have an OpenFileDialog that allows me to point to a database file that I want to use. I also include a button that allows the application to save it's configuration to a file. It seems that if I first press the Save Button, configuration saves ok, but if I choose a DB file (with the OpenFileDialog), and then press the save button, no changes are made to the config file. I tried opening the file that the dialog points to, then closing it so there would be no referrence to it (though when i press the save button i always check to see if the config file exists, and assign it to a TextFile var), but with no result.

Any help will be greatly appreciated.

Alex
 
Have you used the debugger to trace through the Save process (after you have chosen a DB file) ?

Can you copy and paste the code in your Save Button's event handler (and any other called code) so that we can look at it?

Andrew
 
I figured it out... When I would press the Open FIle Dialog, the working directory would change to the one where the DB was. So the program tried to use the config file from the DB directory (which btw should have returned an error - because the file didn't exist there). Using the the app's full directory path (path := ExtractFileDir(application.ExeName);) for the config file did the trick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top