Inserting row listbox

Hi,

I want to insert row below the selected row and put text on column 1

I found the code in the LR,

dim o as Integer
for o=ListBox1.Listcount downto 0
  if ListBox1.selected(o) then
    Listbox1.AddRowAt(o+1,"Test")
  end if
next

but I confuse, how to determine the column number. its just added the text on column 0.

thanks
Arief

see CellTextAt
https://documentation.xojo.com/api/user_interface/desktop/desktoplistbox.html#desktoplistbox-celltextat

btw someone who wrote help examples smoke weed or have an issue with copy/paste.

In that example, you probably had row 0 selected.
to get the column, you use LastAddedRowIndex to get the row number of the last added row.

dim o as Integer
for o=ListBox1.Listcount downto 0
  if ListBox1.selected(o) then
    Listbox1.AddRowAt(o+1,"Test")
    Me.CellTextAt(Me.LastAddedRowIndex, 1) = "Text for Column # 1"  // column numbers are zero based
  end if
next

Hi,
this one is worked nice in latest xojo version. But unfortunately, i am still using an older version.

dim o as Integer
for o=ListBox1.Listcount downto 0
  if ListBox1.selected(o) then
    Listbox1.AddRow""
    Listbox1.Cell(o+1,1)="Test"
  end if
next

thanks
arief