Saving ListView SubItems To A SortedList

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

    Saving ListView SubItems To A SortedList

    I'm trying to add the contents of a ListView to a SortedList. The
    ListView contains two columns - "Title" and "URL". I need to add both
    columns to the SortedList with Title being the Value and URL being the
    Key. I can get the information into and out of the SortedList but when
    I add the URL into the SortedList it is in the form "ListViewSubIte m:
    {http://...}". The code I use for this is...

    ListView.Checke dListViewItemCo llection collection = lv.CheckedItems ;

    foreach (ListViewItem item in collection)
    {
    sl.Add(item.Tex t, item.SubItems[2].ToString());
    }

    Is there a way to extract the data from the second column without
    having the extra data being added?

    Rob

  • Jeff Gaines

    #2
    Re: Saving ListView SubItems To A SortedList

    On 02/01/2005 enchantingdb wrote:
    [color=blue]
    > I'm trying to add the contents of a ListView to a SortedList. The
    > ListView contains two columns - "Title" and "URL". I need to add both
    > columns to the SortedList with Title being the Value and URL being the
    > Key. I can get the information into and out of the SortedList but when
    > I add the URL into the SortedList it is in the form "ListViewSubIte m:
    > {http://...}". The code I use for this is...
    >
    > ListView.Checke dListViewItemCo llection collection = lv.CheckedItems ;
    >
    > foreach (ListViewItem item in collection)
    > {
    > sl.Add(item.Tex t, item.SubItems[2].ToString());
    > }
    >
    > Is there a way to extract the data from the second column without
    > having the extra data being added?
    >
    > Rob[/color]

    How about:

    sl.Add(item.Tex t, item.SubItems[2].Text);

    ???

    --
    Jeff Gaines
    Posted with XanaNews 1.17.1.2 http://www.wilsonc.demon.co.uk/delphi.htm

    Comment

    • enchantingdb

      #3
      Re: Saving ListView SubItems To A SortedList

      Thanks Jeff, that worked.

      Rob

      Comment

      Working...