Listbox to Text File

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • markstaylor
    Indigo Rose Customer
    • Oct 2003
    • 296

    Listbox to Text File

    Sorry I know this has been answered before but I can't seem to find it.

    I am simply trying to save the data in a listbox to a textfile when exiting the app.

    Thanks
    SELECT * FROM Users WHERE IQ > 0;
    o rows Returned
  • Sie Tjin Kian
    Forum Member
    • Dec 2004
    • 18

    #2
    one way

    Hi,
    you can do it with this code. Replace "lbox" with the name of your Listbox object. In line 4 you can define the path and name of the textfile.
    Code:
    if ListBox.GetCount("lbox") ~= -1 then
    	-- no error, beginn to read Listbox items
    	index = 1; -- start ist Itemindex "1"
    	file = _TempFolder.."\\test.txt" -- path to textfile
    	repeat
    		TextFile.WriteFromString(file, ListBox.GetItemText("lbox", index).."\r\n",true);
    		index = index + 1;
    	until index > ListBox.GetCount("lbox")
    end
    have a nice day, Tjin

    Comment

    • markstaylor
      Indigo Rose Customer
      • Oct 2003
      • 296

      #3
      Thanks for the help!!
      SELECT * FROM Users WHERE IQ > 0;
      o rows Returned

      Comment

      Working...
      X