Textarea problem. Missing last line

BlitzPlus Forums/BlitzPlus Programming/Textarea problem. Missing last line

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'm having a problem getting the last line in a TextArea when I "do not" hit the return key. Like:

Text line one (hit return)
text line two (hit rturn)
text line three (- do not hit return -)

Running the following code yields no text (characters) for the last line in the textarea gadget:

	file=WriteFile(file_req$)
	
	tl=TextAreaLen(textarea1,2)
	
	For i=0 To tl
		tx$=TextAreaText$(textarea1,i,1,2)
		tnl=Len(tx$)
		
		For ii=0 To tnl
			
			If Mid$(tx$,ii,1)=Chr$(10) Or i=tl
				If i=tl Then ii=tnl
				WriteLine file,Mid$(tx$,1,ii-1)
				ii=tnl
			EndIf
		
		Next
		 
		
	Next
	
			
	CloseFile file


Any ideas on whats wrong?

Thanks,