title: Cannot create a csv file from a datatable and dataview
body: <p>I have code that produces a csv file (with headers) that contain fields identifying pixel locations of points of interest in selected images. Unfortunately, there are occasional duplicates that cause issues later in my production process. My plan to solve this is to open the csv file in the midst of the application, read the data into a data table, sort the data table with a data view using 4 sort keys (I am using the default Column1, Column2 etc) as i cannot figure out ho to use the real column header names contained in the first row. I have attempted to write the resulting rows to a new file, and I get the correct number of rows in the output csv file, but the data in the row is missing and i get a text string ' System.Data.DataRowView, not the 12 fields i was expecting.</p>
  
  <p>In the code, my most recent attempt is to create a writeOutPutLine containing the concatenated contents of the row, in my desired sort order.</p>
  
  <p>I have attempted to use CSVHelper with no success, and also tried about 10 other code sets posted on the various web sites.</p>
  
  <p>Here is my code </p>
  
  <p>Sub New_Csv_Sort()</p>
  
  <pre><code>    Dim linecount As Integer = 1
      Dim dt As DataTable = New DataTable 
      Dim dgv As DataGridView = New DataGridView
      Dim TextLine As String = ""
      Dim SplitLine() As String
      Dim objReader As New System.IO.StreamReader(TargetFileName, Encoding.ASCII)
      Dim ColumnCount As Integer = 0
  
      For ColumnCount = 1 To 13 Step 1
          dt.Columns.Add()
      Next
  
      Dim firstline As Boolean = True
  
  
      Do While objReader.Peek() &lt;&gt; -1
          TextLine = objReader.ReadLine()
          SplitLine = Split(TextLine, ",")
          dt.Rows.Add(SplitLine)
          If FirstTime = True Then 
  
  
  ' Here I was trying to use the first line to set the column labels but no joy
              ' For ColumnCount = 1 To 12 Step 1
              ' dt.datacolumn.
              ' Next
          End If
      Loop
  
      ' This next is commentted out in the sort statement because I could not get the column names to be recognised
  
  '.Sort = "Datum ASC, Picture ASC, Y_Loc ASC, X_Loc, ASC"
  
      Dim dv As New DataView(dt) With {
      .Sort = "Column5 ASC, Column1 ASC, Column12 ASC, Column11 ASC"
      }
      FileOpen(SortedTargetFileNumber, SortedTargetFileName, OpenMode.Output)
  </code></pre>
  
  <p>'I have looked that the data and it is read in correctly
  But my output line is trash!</p>
  
  <pre><code>    For Each Rowview As DataRowView In dv
          'WriteOutPutLine = dv.row
          For Each DataColumn In dt.Columns
              WriteOutPutLine = WriteOutPutLine &amp; Row[col].tostring() &amp; ","
          Next
          WriteOutPutLine = Rowview.ToString
          PrintLine(SortedTargetFileNumber, WriteOutPutLine)
          linecount = linecount + 1
      Next
      FileClose(SortedTargetFileNumber)
      MsgBox("Sorted Lines = " &amp; linecount)
  
  
  End Sub
  </code></pre>