S
SeeBee
This must be easy but I can't get i right.
I have two listboxes, one to the left and on to the right.
The user can add items to the right one be selecting any
items in the left list and press an add button.
This will trigger an action to copy the items to the
listobx to the right:
selCol = LeftListBox.SelectedItems
outCol = RightListBox.Items
For i = 0 To selCol.Count - 1
If Not outCol.Contains(selCol(i)) Then
RightListBox.Items.Add(selCol.Item(i))
End If
Next
This works great. But I also like to be able to select any
items in the right ListBox and remove them by pressing
a "remove-button". I can't get this right though. I've
tried with this code but it obviosly doesn't work:
selCol = RightListBox.SelectedItems
outCol = RightListBox.Items
For i = 0 To outCol.Count - 1
If selCol.Contains(outCol(i)) Then
RightListBox.Items.RemoveAt(i)
End If
Next
Any ideas? Thanks in advance
I have two listboxes, one to the left and on to the right.
The user can add items to the right one be selecting any
items in the left list and press an add button.
This will trigger an action to copy the items to the
listobx to the right:
selCol = LeftListBox.SelectedItems
outCol = RightListBox.Items
For i = 0 To selCol.Count - 1
If Not outCol.Contains(selCol(i)) Then
RightListBox.Items.Add(selCol.Item(i))
End If
Next
This works great. But I also like to be able to select any
items in the right ListBox and remove them by pressing
a "remove-button". I can't get this right though. I've
tried with this code but it obviosly doesn't work:
selCol = RightListBox.SelectedItems
outCol = RightListBox.Items
For i = 0 To outCol.Count - 1
If selCol.Contains(outCol(i)) Then
RightListBox.Items.RemoveAt(i)
End If
Next
Any ideas? Thanks in advance