RowPicture in ListBox with Database

I have a Listbox where I’d like an icon of a folder to appear for every row. I have it working when I enter initial values using a for loop:

for counter=0 to ListBox1.ListCount-1
ListBox1.RowPicture(counter) = folder
Next

The line of code above populates a folder icon for every row. Works perfectly.

However, when I connect a database to the ListBox, my data populates but RowPicture disappears.

I even tried using just:

ListBox1.RowPicture(0) = folder

which causes one icon to appear on the first row when I enter initial values into the ListBox, but it disappears when I connect a database to the ListBox.

Does ListBox treat a database query differently? Is the ListBox not actually adding rows for a database query the way it does for initial values?

I ended up just iterating through every row in the recordset, adding them one-by-one to the ListBox in a while loop.

maybe you overwrite the first column with a value and then the picture disappears? just a idea.
in current docu (xojo version) it is mentioned as RowImageAt.
it is also possible to use the CellBackgroundPaint to paint an icon.

What exactly does that mean?

1 Like

It’s unclear what you mean. What does a listbox have to do with a database?

I populate listboxes using data ontained from various databases, although most of the work is done in the Paint event.

You’ll have to explain what you mean.