This is a migrated thread and some comments may be shown as answers.

RadListBox Transfer Items From Code Behind (VB)

2 Answers 129 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 1
Doug asked on 12 Dec 2014, 12:47 AM
I have two listboxes, lbSelectPhones and lbPhonesDest.  Everything is working great for selecting the desired phones in lbSelectPhones and transferring to lbPhonesDest.  I then store the selections in a SQL table comma separated like CR,CE,CN.

What I need to do now is use that comma separated value CR,CE,CN to auto transfer those selections from lbSelectPhones to lbPhonesDest when the user selects an item from a drop down list.  I've searched with no luck on finding a way to do this.  Please help.

I've tried using lbSelectPhones.Transfer("CR",lbSelectPhones,lbPhonesDest), but it doesn't work since the first argument can't be a string value.

2 Answers, 1 is accepted

Sort by
0
Doug
Top achievements
Rank 1
answered on 12 Dec 2014, 02:01 AM
Update:
This works... almost. It moves the first value in the list, then throws an error -Collection was modified; enumeration operation may not execute.
Thoughts?

Dim strGetPhone() As String
Dim i As Integer
strGetPhone = Split(reader.Item("PhonesToDial"), ",")
For i = LBound(strGetPhone) To UBound(strGetPhone)
For Each item As RadListBoxItem In lbSelectPhones.Items
If item.Value = Trim(strGetPhone(i)) Then
lbSelectPhones.Transfer(item, lbSelectPhones, lbPhonesDest)
End If
Next
Next
0
Plamen
Telerik team
answered on 17 Dec 2014, 06:08 AM
Hi Jack,

In cases when such error is observed the recommended approach is to create a list of items traverse the array and add the ones that you need in the created list. After you traverse the items you can traverse the new list and transfer the items from there one by one. 

Hope this will help you solve the issue.

Regards,
Plamen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ListBox
Asked by
Doug
Top achievements
Rank 1
Answers by
Doug
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or