Muovere una riga in una listbox con più colonne

Ho una lisbox con più colonne, ho la necessità di muovere una riga verso il basso. Impostando nella lisbox “allow row dragging” è possibile selezionare la riga con il mouse e spostarla in o in basso trascinandola con il mouse stesso. è possibile farlo da codice?
Mario

English translation:

I have a lisbox with multiple columns, I need to move a row down. By setting “allow row dragging” in the lisbox it is possible to select the row with the mouse and move it up or down by dragging it with the mouse itself. Is it possible to do it from code?

I have a lisbox with multiple columns, I need to move one row down. By setting “allow row dragging” in the lisbox you can select the row with the mouse and move it up or down by dragging it with the mouse itself. Is it possible to do this from code?

Yes. In fact I just made some video of me doing exactly that, but the forum seems to prevent putting it there.

You need to use a file share service (dropbox, one drive, wetransfer) and post the link to your video here.

I tried copying the row to move
temp(1)=listbox1.cell(listbox1.listindex, 0)
temp(2)=listbox1.cell(listbox1.listindex, 1)
temp(3)=listbox1.cell(listbox1.listindex, 2)
temp(4)=listbox1.cell(listbox1.listindex, 3)
temp(5)=listbox1.cell(listbox1.listindex, 4)
etc
then remove it with Listbox1.RemoveRowAt(y)
so far everything is ok
then insert the copied one
Listbox1.InsertRow y+1, temp(1), temp(2), temp(3), temp(4), temp(5)
It gives me an error to many arguments, in a listbox with only one column it works. If I use listbox1.AddRowAt temp(1), temp(2), temp(3), temp(4), temp(5) it adds it normally but at the end of the list, is there a way to insert it into y+1?

The syntax is:

InsertRow is… old

InsertRow only lets you add the first cell. You have to add the values to the other cells after the row exists.

dim iDest as Integer = y + 1
Listbox1.InsertRow(iDest, temp(1))
Listbox1.Cell(iDest, 1) = temp(2)
Listbox1.Cell(iDest, 2) = temp(3)
Listbox1.Cell(iDest, 3) = temp(4)
Listbox1.Cell(iDest, 4) = temp(5)

Thanks, you’re great!