drag to new listbox and, delete from the original listbox

Hello,
I am able to drag successfully an item from one Listbox to another. However, the problem is that at the end of the successful drag, a copy of the item continues to remain on the original listbox. So, this leaves me with 2 of the same item: one in the original listbox and another in the second listbox where I dragged the item to.

How could I delete the item in the original listbox, once it has been dragged to the new list box?

Thanks

This is how I do it.
In the dragrow event, save the name of the from listbox to a string property on the page and save the row to an integer property on the page. In the DropObject event of all the listboxes call a method, mine is named LbDropped. In the method I use a select case to pick the LbName that I saved and do exampleLB.RemoveRow(ThesavedRow_Property)

Select Case LbName case "LbNotDisp" LbNotDisp.removerow(TheRow) case "LbReady" LbReady.removerow(TheRow) case "LbParts" LbParts.removerow(TheRow) case "LbSent" LbSent.removerow(TheRow) case "LbService" LbService.removerow(TheRow) case "LbWait" LbWait.removerow(TheRow) end select

Thanks


Class Window1 Inherits Window

    Properties
    itemDragged As Pair

    Window1 Control Listbox1:

    Function DragRow(drag As DragItem, row As Integer) As Boolean 
        itemDragged = Me : row // Me = origin listbox 
        drag.Text = "Text" // Just enable drag 
        Return True
    End Function

    Sub DropObject(obj As DragItem, action As Integer) 
        me.AddRow ListBox(itemDragged.Left).Cell(itemDragged.Right, 0) // Add to dest one cell example
        ListBox(itemDragged.Left).RemoveRow(itemDragged.Right) // Remove origin row
    End Sub

    Sub Open() 
        Me.AcceptTextDrop 
    End Sub 

    Window1 Control Listbox2:

    Function DragRow(drag As DragItem, row As Integer) As Boolean 
        itemDragged = Me : row // Me = origin listbox 
        drag.Text = "Text" // Just enable drag 
        Return True
    End Function

    Sub DropObject(obj As DragItem, action As Integer) 
        me.AddRow ListBox(itemDragged.Left).Cell(itemDragged.Right, 0) // Add to dest one cell example
        ListBox(itemDragged.Left).RemoveRow(itemDragged.Right) // Remove origin row
    End Sub

    Sub Open() 
        Me.AcceptTextDrop 
    End Sub 

End Class

Thank you very much Gary and Rick! I will try both methods and let you know. Warm regards, Naren

Hello Rick,
Many thanks! Your advice worked nicely - now I can now drag and move from one listbox to another listbox (the item from the original listbox disappears). This allows for moving one item at a time. How might I do this for (i.e.move) multiple items from one listbox to another (and delete selected items from the original listbox). I guess have to make the itemDragged as array. Thanks

How your user can made a Copy ?

Change the logic here:

    itemDragged = Me : row // Me = origin listbox 

And instead of “row” annotate and pass “rows”, and process all them.

Thanks!
When I changed to,

itemDragged=Me:rows //Me=origin listbox

I get the following error message: ‘This item does not exist’, with ‘rows’ being highlighted.

Should I create an array itemDragged().

Thanks