Moving items from one list box to another (1 Viewer)

froadie

New member
Local time
Today, 05:30
Joined
Feb 12, 2009
Messages
5
I'm trying to move items from a list box with 3 columns to another list box with 3 columns. However, the code I'm using only moves the first column. How do I move all 3 columns over?

Here's the code:

Private Sub MoveBetLstBoxes(lstBoxFrom As ListBox, lstBoxTo As ListBox)
Dim item As Variant
If lstBoxFrom.ItemsSelected.Count = 0 Then
MsgBox "Please select an insurance company", vbOKOnly, "Error"
Else
Dim index As Integer
For Each item In lstBoxFrom.ItemsSelected
lstBoxTo.AddItem lstBoxFrom.ItemData(item)
lstBoxFrom.RemoveItem lstBoxFrom.ItemData(item)
Next
End If
End Sub
 

ajetrumpet

Banned
Local time
Today, 07:30
Joined
Jun 22, 2007
Messages
5,638
use the
Code:
.column(index number)
code to specify the column too. Also, there are 2 facts on this type of thing. One by me in the FAQ section, and another by DCRAKE in the sample databases section..
 

DCrake

Remembered
Local time
Today, 13:30
Joined
Jun 8, 2005
Messages
8,632
Try this demo
 

Attachments

  • ListBoxDemo.zip
    51.9 KB · Views: 3,393

Users who are viewing this thread

Top Bottom