title: How to get a datagrid cell values
body: <p>Using VB.Net</p>
  
  <p>I want to get a all datagrid cell values, then insert into table1.</p>
  
  <p>Code</p>
  
  <pre><code>cmd = New SqlCommand("insert into table1 values('" &amp; DataGrid.Rows(0).Cells(0).Value &amp; "', '" &amp; DataGrid.Rows(0).Cells(1).Value &amp; "', '" &amp; DataGrid.Rows(0).Cells(2).Value &amp; "', '" &amp; DataGrid.Rows(0).Cells(3).Value &amp; "')", con)
  cmd.ExecuteNonQuery()
  </code></pre>
  
  <p>The above code is inserting first row of datagrid cell value, but i want to insert all the datagrid cell values</p>
  
  <p>How to modify my code for getting all the datagrid cell value.</p>