I have created a MultiListBox control which is populated with a list of all currently loaded TAB file names in MapInfo. The user selections are then read from the MultiListBox and added to another array (so I can use these in an INSERT command later on).
However the problem I am getting is when I select records from my MultiListBox. As an example I have selected 3 TAB files (3 records) from my MultiListBox but my array size is only 2. If I select 5 records from my list my array size is only 4 and so on. When I select just the 1 record from my list my array size is saying 0.
If someone could help I would be very grateful.
Cheers
Rob O'Brien
Here are some code snippets to help.
Dim i as integer
Dim j as integer
i = NumTables()
ReDim TableArray(i)
For j = 1 to i
TableArray(j) = TableInfo(j, TAB_INFO_NAME)
Next
Print "Table Array no. of records: " + UBound(TableArray)
' code to read the values selected in the MultiListBox
Dim iSel, j As Integer
j = 0
iSel = ReadControlValue(1)
Do Until iSel = 0
j = j + 1
Redim SelectionArray(j) ' re-size our array. Now = 1
SelectionArray(j) = iSel
iSel = ReadControlValue(1)
Print "Selection Array items selected: " + SelectionArray(j)
Loop
Print "MultiListBox no. of selected records: " + UBound(SelectionArray)