For instance, maybe the first list box contains a list of customers, and you want to perform some function (say, email them) that pertains to only a few of those customers. By double-clicking on the customer names you want, you get the desired list in the right hand box.
First, make a generic sub that takes two listbox arguments:
Expand|Select|Wrap|Line Numbers
- Private Sub MoveListItem(lstFrom As ListBox, lstTo As ListBox)
- lstTo.AddItem (lstFrom.Value)
- lstFrom.RemoveItem (lstFrom.Value)
- End Sub
Expand|Select|Wrap|Line Numbers
- Private Sub lstA_DblClick(Cancel As Integer)
- MoveListItem Me.lstA, Me.lstB
- End Sub
- Private Sub lstB_DblClick(Cancel As Integer)
- MoveListItem Me.lstB, Me.lstA
- End Sub
It's a simple task but can come in handy!
Pat