title: Send text from textboxes to datagrid
body: <p>I have for textboxes on my form and I would like the text there to be send to a datagrid. I wrote the following:</p>
  
  <pre><code>Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  
      Dim itemName As String = txtItem.Text
      Dim qty As Double = CDbl(txtQTY.Text)
      Dim price As Double = CDbl(txtPrice.Text)
      Dim Total As Double = price * qty
  
      txtTotal.Text = Convert.ToString(Total)
  
      Dim row As Integer = grdNewInvoice.Rows.Count
  
      Dim data As TextBox() = New TextBox() {txtItem, txtQTY, txtPrice, txtTotal}
      grdNewInvoice.Rows.Add()
  
      For i As Integer = 0 To data.Length - 1
          grdNewInvoice(i, row).Value = data(0)
  
      Next
  
  
  End Sub
  </code></pre>
  
  <p>But I get the  following on my datagrid row: <code>System.Windows.Forms.TextBox, Text:</code> [textbox string]</p>
  
  <p>I tried the following code as well to make sure there was nothing wrong with my settings on my datagrid:</p>
  
  <pre><code>'grdNewInvoice.Rows(0).Cells(0).Value = itemName
      'grdNewInvoice.Rows(0).Cells(1).Value = qty
      'grdNewInvoice.Rows(0).Cells(2).Value = price
      'grdNewInvoice.Rows(0).Cells(3).Value = Total
  </code></pre>
  
  <p>That worked fine and the text went in as expected but since I will be writing to multiple lines on the datagrid, I will need to use a loop.  </p>
  
  <p>What am I doing wrong here?</p>