Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 [RESOLVED] Getting the value of a My.Settings item (string collection)

$
0
0
Hey guys,

I created a new My.Settings entry named "AllCities". It is a list (string collection) of a couple hundred cities, each one on a separate line. On form load, I want to grab the value of "AllCities" and populate a ListView with those cities. Here's what I have so far...

Code:

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim AllCitiesString = My.Settings.AllCities.ToString
        Dim AllCitiesList As New List(Of String)(AllCitiesString.Split(Environment.NewLine))

        For Each City As String In AllCitiesList
            ListView1.Items.Add(City)
        Next

    End Sub

But when I run the above code, the only text I get in the ListView is "Systems.Collections.Specialized..."

What am I missing here?

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>