Load a Settings.settings into ListView?
- by clefranc
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