Export Datagridview To Text File Vb.net

 
Export Datagridview To Text File Vb.net

Using Datagridview Vb

To do this, you just need to use a writer, and go through it in the way you want. Using writer As New System.IO.StreamWriter(filePath)For row As Integer = 0 To dgvMeasures.RowCount - 1For col As Integer = 0 To dgvMeasures.ColumnCount - 1writer.WriteLine(dgvMeasures.Rows(row).Cells(col).Value.ToString)NextNextEnd UsingThis will go through each column for each row (as you describe), and then go to the next row.I am sure you have a reason for writing the text file like this, but if you want to read it back in at some point, I would really recommend using a tab-delimited (or similar) format.