Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Visual Basic 2008 CSV Headers

Avatar of disrupt
disruptFlag for United States of America asked on
.NET ProgrammingVisual Basic.NET
5 Comments1 Solution341 ViewsLast Modified:
I need to enumerate the CSV headers and search for a header name and save it's column number to the currentRow like this I can add it to a listView. I have a code example and commented code of what im trying to do.  How can I do this?
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(filepath)

                MyReader.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited
                MyReader.Delimiters = New String() {","}
                MyReader.CommentTokens = New String() {""}
                MyReader.HasFieldsEnclosedInQuotes = True

                Dim currentRow As String() = MyReader.ReadFields

                While Not MyReader.EndOfData
                    Try
                        currentRow = MyReader.ReadFields()
                        Dim item As ListViewItem
						
						' Dim NameHeader As Coloumn Header
						' for each header in headers if header = "name"  NameHeader = currentRow(i)

                        If currentRow.Length = 10 Then
                            item = ListView1.Items.Add("TEST")
                            'item.SubItems.Add(NameHeader)
                            item.SubItems.Add(currentRow(5))
                        Else
                        End If

                End While
            End Using
ASKER CERTIFIED SOLUTION
Avatar of Dabas
DabasFlag of Australia image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answers