Load a Settings.settings into ListView?

Posted by clefranc on Stack Overflow See other posts from Stack Overflow or by clefranc
Published on 2010-05-02T05:19:26Z Indexed on 2010/05/02 5:27 UTC
Read the original article Hit count: 470

Hi, I've managed to save ListView items to a System.Collections.Specialized.StringCollection property settings using this LINQ one liner:

My.Settings.Property1.AddRange(ListView1.Items.Cast(Of ListViewItem)().[Select](Function(a) String.Join(Convert.ToChar(Keys.Tab), a.SubItems.Cast(Of System.Windows.Forms.ListViewItem.ListViewSubItem)().[Select](Function(s) s.Text).ToArray())).ToArray())

Now, I want to do the opposite, ie load the ListView1 from the My.Settings.Property1. It's fairly easy to do using a For Each loop, but I wonder if someone can show me a similar LINQ query.

The lines in My.Settings.Property1 looks like this (Tab separated):

Word1   Word2   Word3   Word4
Word5           Word6

Original code is from this answer: http://stackoverflow.com/questions/2295068/show-listview-items-in-a-combobox

© Stack Overflow or respective owner

Related posts about listview

Related posts about listviewitem