Saving ListView SubItems To A SortedList

  • Thread starter Thread starter enchantingdb
  • Start date Start date
E

enchantingdb

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 "ListViewSubItem:
{http://...}". The code I use for this is...

ListView.CheckedListViewItemCollection collection = lv.CheckedItems;

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

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

Rob
 
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 "ListViewSubItem:
{http://...}". The code I use for this is...

ListView.CheckedListViewItemCollection collection = lv.CheckedItems;

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

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

Rob

How about:

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

???
 
Back
Top