I did this myself on the simple way:
dim rows as integer =
dim col as integer =
dim regel1 as string = Nothing
For i = 0 To rows
For j = 0 To columns
regel1 += DataGridView1.Rows(i).Cells(j).Value + vbCrLf
Next
Next
Dim objWriter20 As New System.IO.StreamWriter("somefile.txt")
objWriter20.WriteLine(regel1)
objWriter20.Close()
and read again:
Infile = IO.File.OpenText("somefile.txt")
For i = 0 To rows
For j = 0 To columns
DataGridView1.Rows(i).Cells(j).Value = Infile.ReadLine()
Next
Next
Infile.Close()