title: "value of type datagridviewcell can not be converted to string" vb.net
body: <p>I am trying to take data from a DataGridView and save that data into a txt file so it can be loaded into the grid later.  Right now, it will save the file, but will not write to the file because of the error </p>
  
  <p>"value of type datagridviewcell can not be converted to string" or </p>
  
  <p>"An unhandled exception of type'System.FormatException' occurred in mscorlib.dll
  Additional information: Input string was not in a correct format." </p>
  
  <p>I'm not sure what to do and I couldn't find a solution anywhere.</p>
  
  <pre><code>Private Sub SaveButton_Click(sender As Object, e As EventArgs) Handles SaveButton.Click
      'SGD is my save file dialog box
      SGD.ShowDialog()
      Using writer As New StreamWriter(SGD.FileName)
          For Each row As DataGridViewRow In QAfield.Rows
              writer.WriteLine(row.Cells.Item("AgentColumn").ToString, row.Cells.Item("ScoreColumn"), row.Cells.Item("PassColumn"), row.Cells.Item("FailColumn"))
  
          Next
      End Using
  End Sub
  </code></pre>