0

Hello everyone!
I am wondering how I would transfer items from one listbox to another. Both these listboxes are multicolumn and I need to transfer information from both those columns to the other two columns.

Here is my code so far:

Private Sub cmdAdd_Click()
'******************************************************
Dim intPosition%
Dim strTransfer$, strTransfer2$
'******************************************************

'looks to see what was selected
For intPosition = 0 To lstStudents.ListCount - 1
    If lstStudents.Selected(intPosition) = True Then
        'it was selected
        Exit For
    End If
Next intPosition

'takes what was selected and transfers it over
strTransfer = lstStudents.Column(0, intPosition)
strTransfer2 = lstStudents.Column(1, intPosition)

'adds it over
lstRoster.AddItem (strTransfer & strTransfer2)
End Sub

Thanks for the help!

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by AndreRet
0

Attached is a sample of ALL listbox functions. At the bottom right you will find listbox copy including multiple coloumns. You obviously have to change the sample to suit your needs. This was obtained a while ago from vbfx.com

I hope this helps to solve your problem AND to add some more features regarding list boxes.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.