Source language: Translate to:

Text Entry Question, Multi-Line TextEntry as a text editor -

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

Text Entry Question, Multi-Line TextEntry as a text editor -

Postby Jim Brammer » Thu Feb 07, 2002 5:15 pm

I would like to use the text entry tool to allow a user to type in several paragraphs, then save that text to a .txt file.

When I do this now, it records the line returns (carriage returns, or "enter" key) as a long vertical line which shows up in the text document. The whole text is recorded on a single line in the .txt document.

Ideally, I would like for each line in the text entry box to write as a new line in the txt file. Is there a way to do this?


<hr>


Hi Ralph,

When you FileWrite to your file use "ALL" as the linenumber...

FileWrite "Textfile.txt" "ALL" "[Text]"


<hr>


Thanks, Jim. That did it.

The only problem was that I will have already written other text to the file, and the "ALL" command seems to overwrite that text.

What I will do (unless you have another brillian solution) is write the text to a temp file using the ALL command, then read it back in line by line and then write it to the end of the target file. Should work fine.

Thanks again for your immediate help


<hr>


You might try to FileRead "ALL" your text file first, then combine the two on FileWrite.

FileExists "Text.txt" "[Text_Ex]"
If "[Text_Ex]" "=" "True"
FileRead "Text.txt" "ALL" "[ExistingText]"
FileWrite "Text.txt" "ALL" "[ExistingText]||[Text]"
Else
FileWrite "Text.txt" "ALL" "[Text]"
EndIf
Jim Brammer
 

Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: No registered users and 1 guest