title: Save data to text file from DataGridView in VB.net
body: <p>I have a data grid view containing 6 columns...</p>
  
  <p>I need to save all of the rows and columns on one line per String</p>
  
  <p>For example:</p>
  
  <p><a href="https://i.stack.imgur.com/SmbwL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SmbwL.jpg" alt="Table"></a></p>
  
  <p>When this table's data is saved into the text file it should look like this:</p>
  
  <pre><code>John
  0000000000
  M
  Mike
  0000000000
  M
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I have tried this kind of thing:</p>
  
  <pre><code>Dim name As String = DataGridView1.Rows(e.RowIndex).Cells(1).Value
  Dim mobile As String = DataGridView1.Rows(e.RowIndex).Cells(2).Value
  Dim gender As String = DataGridView1.Rows(e.RowIndex).Cells(3).Value
  
  Dim fileName As String = CurDir() + "\Measures.txt"
  Dim fileNum As Integer = FreeFile()
  
  FileOpen(fileNum, fileName, OpenMode.Output)
  
  PrintLine(fileNum, name)
  PrintLine(fileNum, mobile)
  PrintLine(fileNum, gender)
  </code></pre>
  
  <p>note: The data should be saved as a string</p>
  
  <p>Any help would be appreciated, thanks</p>