There is more than one way.
Here's one way
tinstaafl
Nearly a Posting Virtuoso
1,303 posts since Jun 2010
Reputation Points: 341
Solved Threads: 225
Skill Endorsements: 14
Did you add the columns as per the page I gave you?
tinstaafl
Nearly a Posting Virtuoso
1,303 posts since Jun 2010
Reputation Points: 341
Solved Threads: 225
Skill Endorsements: 14
When you get the error in the error window at the bottom it should report the line number with the error. That's the code we need to see.
tinstaafl
Nearly a Posting Virtuoso
1,303 posts since Jun 2010
Reputation Points: 341
Solved Threads: 225
Skill Endorsements: 14
Here's a simple example of code you can use, you'll have to import System.IO
'Read the file an put each line into a list. Each line will be an item with subitems in the listview
CSVTest = File.ReadAllLines("C:\test.csv").ToList
'This adds the column headers. If the first line of your file isn't header text, just use a comma delimeted string of the text that you want.
Dim ColNames As List(Of ColumnHeader) = New List(Of ColumnHeader)
'Replace `CSVTest(0)` with your new string if necessary.
Dim ColumnArray() As String = CSVTest(0).Split(",")
For i = 0 To ColumnArray.Count - 1
ColNames.Add(New ColumnHeader)
ColNames(i).Name = ColumnArray(i)
ColNames(i).Text = ColumnArray(i)
Next
ListView1.Columns.AddRange(ColNames.ToArray)
'This adds the rest of the data from the file to the listview. If the first line of the file is data and not header text, then change `For I = 1 To CSVTest.Count - 1` to `For I = 0 To CSVTest.Count - 1`
For I = 1 To CSVTest.Count - 1
Dim col() As String = CSVTest(I).Split(",")
Dim NewLVItem As ListViewItem = New ListViewItem(col(0))
NewLVItem.Name = col(0)
For j = 1 To col.Count - 1
NewLVItem.SubItems.Add(col(j))
Next
ListView1.Items.Add(NewLVItem)
Next
tinstaafl
Nearly a Posting Virtuoso
1,303 posts since Jun 2010
Reputation Points: 341
Solved Threads: 225
Skill Endorsements: 14
oops missed a line. First line should be Dim CSVTest as List(Of String) = New List(Of String)
tinstaafl
Nearly a Posting Virtuoso
1,303 posts since Jun 2010
Reputation Points: 341
Solved Threads: 225
Skill Endorsements: 14