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

VS 2010 ListView Items and Text from CSV File.

$
0
0
Hi.

How can I populate a ListView with a CSV file? My CSV file is like this:

John,Image1.bmp
Kenny,Image2.bmp
Jimmy,Image3.bmp

The first value is the Text of the item. The second value is the image's name.
I made this code to loop through the CSV File, but I don't know how to insert the image into the item.

Code:

Dim Items() As String.
        Dim Lines() As String = IO.File.ReadAllLines(Path.Combine(Application.StartupPath, "TestCSV.txt"))

        For Each Line As String In Lines
            ' CSV(0) = Text
            ' CSV(1) = Image Location
            CSV = Line.Split(",")
 
            Dim bm As New Bitmap(Path.Combine(Application.StartupPath, "Images\" & Items(1)))
 
        Next

Now that I have the values, how can I create a new ListView Item with the text and the image from that values?
Also, I'm using a ListView with LargeIcons.

Viewing all articles
Browse latest Browse all 27156

Trending Articles



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