Displayindex error for listview

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ryan Dawson

    #1

    Displayindex error for listview

    Hello. I am getting an error when trying to remove/access items inside of a
    listview:

    System.Argument OutOfRangeExcep tion: Specified argument was out of the range
    of valid values.
    Parameter name: '500' is not a valid value for 'displayIndex'.

    I only remove item 500 from the listview if the number of items is greater
    than 500 (so it removes the last item). Also, I am updating items in the
    listview with code:

    try
    for each node in listview.items
    if node.subitems(1 ).text = *what i'm looking for* then
    node.subitems(2 ).text = "Whatever"
    end if
    next node
    catch
    end try

    Now here's the fun fact: Adding, updating and removing items from the
    listview are all contained in separate try blocks. Adding and updating
    items are called from another class via raised events.

    What is causing this error and how do I fix it?

    Thanks,

    Ryan


Working...