Re: Open / save / save as in Delphi

Posted by webmaster Guido

In Reply to: Menu Component ( Open, Save, Save as, Print, Close) posted by Lionel Joyner:

: I am working on an Delphi application that performs some computations and displays the results in a ListBox.
: ... but do not know how to Save the Results to a folder on a disk or hard drive or Save the File As something other than text or Open the File once it is saved.

Saving the results in a text file is simple, as you've probably found out already. Because you have them in a ListBox, you can use:

Saving other data then text, requires that you use some form of database:

1. Use a desktop database that is supported by Delphi, such as Paradox or dBase. For this, you need a Delphi version with the database components: D4 Pro and higher, D5 Pro, D6 Pro,...
In that case, it's very simple and we can guide you throught the process :)

2. If you don't have the database stuff in your version of Delphi, you have to create a simple database system of your own, based on text files.
Before writing data, all your data values are converted to text, "fields" are separated separated by a special character, and each "record" is on a separate line of the text-file. Example with semicolon ; as separator:

and so on...

When reading back, you split up each line into strings and convert these strings to their original format (numbers, dates,...)

Which way do you want to go?

Delphi Forum :: Tutorials :: Source code :: Tips