Saving the DesktopListBox Contents

So simple, but I failed…

I am at
t.Write ???? t.Close

Ideas ?

OK, so what do the columns contain? Text? Images? Where are you trying to save it? To a text file? A database? Are you saving Row/CellTags also?

Simple text in 6 columns, nothing fancy.

t.Write is TextOutputStream.Write

Less than 200 lines.

But this is not the trouble, look at TextOutputStream example who uses an OpenDIalog (yes, for TextOutputStream)…

I wasted one hour, maybe more to leads to nothing (I do not even tryied to loop thru the ListBox to save the Rows contents…

This is bad:
t.Write(LB.CellTextAt(LB.AllRows,LB.AllColumns))

The problem lies in .AllColumns. (OutofBoundsException…)

and in the documentation:

AllColumns
A value that indicates all of the columns rather than a specific row.

the last word can’t be row, but must be column instead, IMHO.

Maybe you are looking for .Content
https://documentation.xojo.com/api/user_interface/desktop/desktoplistbox.html#desktoplistbox-content

1 Like

I don’t think that means “the content of all columns”, that tends (IIRC) to apply to an action which will be done to all columns.

Anyway I suspect that @AlbertoD has the answer.

I finally fall into that and find your answer.

Thank you Alberto.

AllRows forks for all Rows, so why an OutOfBoundsException with AllColumns ???

PS: I never told the forum about my quest to populate the Header (HeaderAt…)

You can use my class
lb_pptes.xojo_binary_project.zip (12.9 KB)

You can give me your opinion
The code is open for all free of charge !