Text File to ListBox

Hello, i need to take the information of all the lines of a text file, and add them to a list box automatic, any help? please. I Try with the visual basic code and adapt to xoxo but i can’t , thanks in advance. (I am working with Mac)

Try

Listbox1.Cell(-1,-1) = TextInputStream1.ReadAll

thanks, but, its works for an archive txt in a location?

  1. Construct a FolderItem pointing to the file.
  2. Open a TextInputStream on that FolderItem.
  3. Use the code above.

Like this?

Dim f As FolderItem
f=GetFolderItem("/Users//Desktop/.rtf")
Listbox1.Cell(-1,-1) =TextInputStream.Open(f).ReadAll

i put this with the original location with my username and etc, but it doesn’t works, when the code run shows an error

what are these < and >

is the filename archivo.rtf ?

then use
f = SpecialFolder.Desktop.Child(“archivo.rtf”)
if f <> nil and f.exists then

and you should use txt files (plain text), not rtf

Yes, the location that i put on my project are this muy username and the name of the file

Axel, thanks it works but when add the rows add things that aren’t in the text

Yes!, but when i open text edit i can’t save it in txt

How i can save it in txt? ( I am new at Mac)

open it with TextEdit and hit shift + cmd + T
save it. (cmd + S)

you get a file archivo.txt

thanks! Now i can, thanks so much

here is an Xojo Project I made to convert Text Files on OSX

Download