Two List Box (to Add & remove items ) - TechRepublic
General discussion
January 29, 2003 at 08:04 PM
thakker123

Two List Box (to Add & remove items )

by thakker123 . Updated 23 years, 4 months ago

Hello
i have to findout what is wrong in this syntex
i have 2 list box
user can select multiple items and click on Cmdadd then that item is to add in list2 & also get remove from list1

below is the syntex

Private Sub CmdRem_Click()
If List2.SelCount = 1 Then
List1.AddItem List2.List(List2.ListIndex)
List2.RemoveItem List2.ListIndex
ElseIf List2.SelCount > 1 Then
Dim b
b = (List2.ListCount – 1)
For a = 0 To b
If List2.Selected(a) = True Then
List1.AddItem List2.List(List2.ListIndex)
List2.RemoveItem List2.ListIndex
End If
Next
Else
MsgBox “Please select the item to remove from savein box”
End If
End Sub

Thanks
athakker

This discussion is locked

All Comments