RadListBox Transfer Items From Code Behind (VB)

3 posts, 0 answers
  1. Jack
    Jack avatar
    9 posts
    Member since:
    Dec 2013

    Posted 11 Dec 2014 Link to this post

    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. Jack
    Jack avatar
    9 posts
    Member since:
    Dec 2013

    Posted 11 Dec 2014 in reply to Jack Link to this post

    This works... almost. It moves the first value in the list, then throws an error -Collection was modified; enumeration operation may not execute.

    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
  3. DevCraft R3 2016 release webinar banner
  4. Plamen
    Plamen avatar
    2724 posts

    Posted 17 Dec 2014 Link to this post

    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.


    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.

Back to Top