if I run my project from iCloud then this code works as it should:
for i=0 to listbox1.columnCount-1
txt=ListBox1.cell(0,i)
SortCol.AddRow(txt)
next
If I copy the project down to my desktop folder and run it from there then the second line:
txt=ListBox1.cell(0,i)
produces an Out of Bounds error
Tried cellvalueat - makes no difference.
Why is this happening? HELP please!
How many columns do you get in the Xojo Cloud version vs the one when run on desktop? Does the ListBox have the same columns # using the same data?
Javier - you have struck gold. Copied the data file down from iCloud to desktop - now works as it should. Many thanks.
Just to go off on a bit of a tangent, you can also start your loop with
Dim u as integer=listbox1.columnCount-1
for i=0 to u…
Back in the Pleistocene days of REALBasic, this was said to be faster because otherwise “listbox1.ColumnCount-1” gets re-evaluated before each pass. In keeping with the Pleistocene, my convention for using “u” for this comes from the old “UBound”.
Maybe trivial, but I felt like chiming in.
Never mind the data source, go through it with the debuugger and see if all is as expected.
Anyway it would be a good idea to check always for the “expected” limits in your code, just in case…