I use the following code to item entered into a ExitText and append to an existing text file. I then sort it alphabetically. This all works perfectly but when I write the final text file (line 7 of the code below) it always finishes with a blank line. Can anyone help me delete this blank line. List.Size does not count the empty line either.
Here is the code:
Sub EditText1_EnterPressed
outFile.Initialize(File.OpenOutput(File.DirDefaultExternal, Text3, True))
outFile.Write (CRLF & Text2)
outFile.Close
List1.Initialize
List1 = File.ReadList(File.DirDefaultExternal, Text3)
List1.Sort(True) 'Sort list in descending alphabetical order
File.WriteList(File.DirDefaultExternal, Text3, List1)
EditText1.Text = ""
End Sub
Here is the code:
Sub EditText1_EnterPressed
outFile.Initialize(File.OpenOutput(File.DirDefaultExternal, Text3, True))
outFile.Write (CRLF & Text2)
outFile.Close
List1.Initialize
List1 = File.ReadList(File.DirDefaultExternal, Text3)
List1.Sort(True) 'Sort list in descending alphabetical order
File.WriteList(File.DirDefaultExternal, Text3, List1)
EditText1.Text = ""
End Sub