Hey list,

okay this seems strange to me but maybe someone can shed some light on what is happening.

I have a simple 4 column list box. I am outputting each cell into a simple textoutput stream after closing the program. When I reopen the program, it reads the values back in. All works great.

BUT.....

If I reopen the program and do nothing but close it, it doesn't see any of the values in the list box that it just read from the file and writes a blank file.

If after I reopen I add a new row, or delete a row, it works fine. It's almost like the rows in listbox don't exist if I don't alter them. Also simply changing a value in an existing row doesn't work. I have to add or delete a row.

Here is the code in my app close event:

  dim f as folderItem
  dim i, lc as integer
  dim filestream as textoutputStream

  f = documentsFolder.child("Harvest_Log.txt")
  filestream= f.createTextFile

lc = logwindow.listBox1.listcount '//// I created this just so I could look at the value of listcount. It is zero on the 2nd opening...//////

  for i = 0 to logwindow.listBox1.listcount - 1
    filestream.writeline logwindow.listBox1.cell (i,0)
    filestream.writeline logwindow.listBox1.cell (i,1)
    filestream.writeline logwindow.listBox1.cell (i,2)
    filestream.writeline logwindow.listBox1.cell (i,3)
    filestream.writeline logwindow.listBox1.cell (i,4)
  next
  filestream.close

I am using RB 5.2.4 on a G5 OSX 10.4.8

thanks,

Joel

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to