0

I have the folling code which imports my CSV file into the respective columbs on my datagridview
I would like to clean the string by removing any " from the string before populating the datagridview.

can anyone point me in the right direction please?

 Dim newstring As String = Nothing 
        Dim sr As New IO.StreamReader("c:\vectacus.csv")
        Dim dt As New DataTable
        Dim newline() As String = sr.ReadLine.Split(","c)
        dt.Columns.AddRange({New DataColumn(newline(0)), _
                             New DataColumn(newline(1)), New DataColumn(newline(2)), New DataColumn(newline(3)), New DataColumn(newline(4)), New DataColumn(newline(5)), New DataColumn(newline(6)), New DataColumn(newline(7)), New DataColumn(newline(8)), New DataColumn(newline(9)), New DataColumn(newline(10))})
        While (Not sr.EndOfStream)
            newline = sr.ReadLine.Split(","c)
            Dim newrow As DataRow = dt.NewRow
            newrow.ItemArray = {newline(0), newline(1), newline(2), newline(3), newline(4), newline(5), newline(6), newline(7), newline(8), newline(9), newline(10)}
            dt.Rows.Add(newrow)
        End While
        DataGridView1.DataSource = dt`
Attachments Picture1.jpg 72.21 KB
2
Contributors
1
Reply
13
Views
2 Years
Discussion Span
Last Post by Reverend Jim
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.