You also need an extra variable to receive the strings that you read fromthe file. Finally, 'close' the text file with CloseFile.The example below shows how to save the contents of two Edit-components to a textfile C:TestData.txtprocedure TForm1.btnWriteClick(Sender: TObject) varF: TextFile beginAssignFile(F, 'C:TestData.txt') Rewrite(F) WriteLn(F, Edit1.Text) WriteLn(F, Edit2.Text) CloseFile(F) end Reading strings from a text file is very similar, but in order to be on the safeside, you need an extra step.īefore trying to read, you have to check if the fileexists. You can repeat this step asmanytimes as you want. If there is already a file withthe same name, it will be overwritten. This means,that a new text file will be created on the disk. 'Open' the text file for writing with the command Rewrite. Use the command AssignFile to connect the TextFile variable to aphysicalfile on disk. Writing and reading to/from a text fileFor saving one or more strings to a text file, you code the following steps. Alright i solved the problem! Many thx for the help. I have tried some things on how to save the contents of a listbox but my file is just empty no matter what i do. I visited some forums on how to save the contents of a listbox to a file but found nothing usefull for me. Hi i am new to wpf and i want to save the content of my listbox to a file. First listbox contains tables: Cars Customers Users Suppliers The second listbox lin. I want to save to.ini and after fill checklistbox items from the saved ini file. Set up a full file name with drive and path fullFileName:= 'C: Program Files Borland Delphi7 Projects Unit1.dcu' // Show the component parts of this full name.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |