Create Multi Column Listbox with Xojo

 

A source code example how to create a multi column ListBox with Xojo programmatically and inserting data from a RecordSet.

Using:
Max OSX Mavericks
Xojo 4.1

 

DataList is the name of the Listbox.
rs is the RecordSet with data.
The number of columns are read from the RecordSet "rs.FieldCount".
For each row in the RecordSet a row is added to the ListBox.

 

    Dim rowInt As Integer
    Dim colInt As Integer
    
    If rs <> Nil Then
      While Not rs.EOF
        
        For colInt = 1 To rs.FieldCount
          DataList.AddRow("")
          DataList.Cell(rowInt,colInt-1)=rs.IdxField(colInt).StringValue
          colInt = colInt + 1
        Next
        
        rs.MoveNext
        rowInt = rowInt + 1
        
      Wend
      rs.Close
    End If