Listbox multiple selection
-
Hi everybody I have two listboxes. I have set the selectmode to multiple but when i select multiple items from listbox1, and then clcik ADD button, only one item is getting added How can i add all the selected items at a time I am using Protected Sub btnAdd_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.ServerClick Dim licCollection As ListItemCollection licCollection = New ListItemCollection() Dim intCount As Integer For intCount = 0 To lstAllAccounts.Items.Count - 1 Step intCount + 1 If (lstAllAccounts.Items(intCount).Selected = True) Then licCollection.Add(lstAllAccounts.Items(intCount)) End If Next Dim intCount1 As Integer For intCount1 = 0 To licCollection.Count - 1 Step intCount + 1 lstAllAccounts.Items.Remove(licCollection(intCount1)) lstAccountAccess.Items.Add(licCollection(intCount1)) Next End Sub thanks
-
Hi everybody I have two listboxes. I have set the selectmode to multiple but when i select multiple items from listbox1, and then clcik ADD button, only one item is getting added How can i add all the selected items at a time I am using Protected Sub btnAdd_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.ServerClick Dim licCollection As ListItemCollection licCollection = New ListItemCollection() Dim intCount As Integer For intCount = 0 To lstAllAccounts.Items.Count - 1 Step intCount + 1 If (lstAllAccounts.Items(intCount).Selected = True) Then licCollection.Add(lstAllAccounts.Items(intCount)) End If Next Dim intCount1 As Integer For intCount1 = 0 To licCollection.Count - 1 Step intCount + 1 lstAllAccounts.Items.Remove(licCollection(intCount1)) lstAccountAccess.Items.Add(licCollection(intCount1)) Next End Sub thanks