Crash Course
Delphi 15 [beta]:
(Continued in Lesson 16)
|
Parsing a CSV file![]() About loading and parsing a csv file Setup of the projectCreate a small database to keep our stock of office material.
The file format should follow the rules as explained in lesson 14. Set up the following structure, either
with MS Excel (see last part of lesson 14) or with a text editor, and
save as Office.csv
|
What should the OnClick event handler of FileLoad do?
What should ParseRecord do with a string (i.e. a record) that it receives?
(To make things not too complicated, let's assume that there are no double quotes nor commas embedded in the field values. In a next version, we'll design a more complete algorithm.)
And finally, the OnClick event handler of FileExit should simply stop the application. As you remember, this is done by closing its main window (its only window in this case).
As you see, we don't let the user select a file just yet, we hard coded for one particular file. The file selection code is discussed in a next lesson.