Add listbox row as row = 0

Hi,
I want to add a listbox row in fron of already displayed rows, as row = 0.
with AddRowAt I can only pass 1 value, but I have more than 1 columns.
I know I can add the row at the end and sort afterwards.
Is it possible to add a row in row=0 with more than 1 column ?

You need to use the CellTextAt method to populate the other cells of the row.

listboxInstance.AddRowAt(0, "Inserted Row")
listboxInstance.CellTextAt(0, 1) = "Column 2"
listboxInstance.CellTextAt(0, 2) = "Column 3"

You can also use the LastAddedRowIndex property to access the last added row:

listboxInstance.AddRowAt(10, "Inserted Row")
var lastIndex as Integer = listboxInstance.LastAddedRowIndex
listboxInstance.CellTextAt(lastIndex, 1) = "Column 2"
listboxInstance.CellTextAt(lastIndex, 2) = "Column 3"
1 Like

hi Anthony,
is there a way to just a blank row and fill all the columns afterwards ?

Sure. You can do either of the following:

listboxInstance.AddRow("")

or

listboxInstance.AddRowAt(0, "")

Then you can use CellTextAt to fill the data later.

ok, works perfect

thanks Anthony