ListBox as a parameter

Hi
I have a window that populates a listBox based on some reults from a SQL query (from db1)
I now need to populate another DB with the content of that list box. (say db2)

I have a button on the windows the populates the list box (Easy to do)
There is also a button to save this content.
The code for saving back to DB is in a seperate class.

What i am trying to do is pass the listbox as a parameter. In the buttons action (on the window where the lstBox is present), i have
retCode = app.dbSnowSQL.mergeWorkSet(tbNewWorkSet.Text, _
tbWrkSetSourceConnector.Text, _
tbWrkSetTargetConnector.Text, _
escExportFolder, _
tbMaxFileSize.Text, _
lstBoxSBSchemas)

In the class, i have the method whose parameters are:-
worksetName As String,
sourceName As String,
targetName As String,
exportLocation As String,
maxFileSize As String,
lstBoxSBSchemas As Listbox

The code to process the list box content is
For Each row As ListboxRow In lstBoxSBSchemas

<>

Next

My problem is that i get the compile error:
SnowflakeSQL.mergeWorkSet, line 42
This object does not implement the Iterable interface and cannot be used in a For Each loop
For Each row As ListboxRow In lstBoxSBSchemas

I suspect the lstBox is being passed by reference and is not accessible outside of the window. I tried created a poperty at ‘app’ level of type listBox and set that property to equal the listbox in the window but to no avail.

What is the best way to do this ?

Thank you in advance.

for i as integer=0 to ubound(lstBoxSBSchemas)
var row as ListboxRow = lstBoxSBSchemas(i)
if row<>nil then
...
end if
next i

you must use your own var (here it is “i”) to iterate as it is not provided with this array

Thank you for the reply.
However using the above, I get compile error :
SnowflakeSQL.mergeWorkSet, line 42
Parameters are not compatible with this function
for i As Integer=0 to ubound(lstBoxSBSchemas)

and

SnowflakeSQL.mergeWorkSet, line 43
This is not an array but you are using it as one
var row As Listbox = lstBoxSBSchemas(i)

Any help appreciated

I found the answer:-
For Each row As ListboxRow In lstBoxSBSchemas.Row
System.DebugLog(row.ColumnValueAt(0))
Next