Listbox add image with other data

Hi guys need some guidance or help here.
i have DB that has first last and an picture.
I am trying to load the contents of the DB into a listbox on a desk top application. I can write and load the image with no problem to individual controls but having a h$$$ of a time figuring out how to make it work with a list box.

here is what i have please point me in write direction. ideally I would want the image to be sized at 42x42 but will take just being able to load multiple images.

sql = "select lastname, firstname, memberimage from t_member "
dim rs as RecordSet = APP.SDS.SQLSelect(sql)

if rs=Nil then
MsgBox" Unable to access "
if rs.RecordCount>0 then

while not rs.eof
  if rs.Field("memberimage") <> nil then
    //Dim b As BinaryStream
    //Dim f as FolderItem
    //f = SpecialFolder.Temporary.Child("temp.jpg")
    //b = BinaryStream.Create(f,true)
    //b.Write rs.Field("memberimage").NativeValue
    listbox1.rowimageat(3)=noimage  (i have this save to application still getting out of bounds errors.)
    //listbox1.cell(Canvas1.Backdrop = f.OpenAsPicture
  end if

MsgBox “No member found.”
end if
end if


Hard to understand what that code is trying to do…

But the Row picture IIRC can only display a 20X20 picture. If you want to display something bigger I would put the Picture in the RowTag you will need to draw it yourself in the CellBackgroundPaint event .

Of course you also need to make sure the listbox row height and that column width are enough to display the Picture…

Row 3 doesn’t exist yet. Accessing a row number that is greater than the number of rows added so far will raise an OutOfBoundsException.

Instead of using the literal row number, use the LastAddedRowIndex property of the Listbox to refer to the most recently added row:

  listbox1.AddRow(rs.Field("lastname").StringValue) ' this row is the LastAddedRowIndex

Also, this earlier line can be modified to use LastAddedRowIndex too:

LastIndex is just the old name for LastAddedRowIndex.