title: For me to be able to select all the row in datagridview
body: <p>For me to be able to select all rows in my datagrid and after i select all the row the next step im going to do is to save all the rows i have selected in other table through database now im using a checkbox to select all the rows i have the code for checking all the checkbox my problem is the saving to save all the rows that ive checked in just one button</p>
  
  <pre><code> Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As                   System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
  Dim countCheckDatas As Integer = 0
  If e.RowIndex = -1 Then
      '----------Check if all datagridview columns as checked----------
      For count = 0 To DataGridView1.RowCount - 1
          If DataGridView1.Rows(count).Cells(e.ColumnIndex).Value = True Then
              countCheckDatas += 1
          End If
      Next
      If countCheckDatas &lt;&gt; DataGridView1.RowCount Then
          If MsgBox("Do you want to check all checkbox ?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Check all") = MsgBoxResult.Yes Then
              For DGVCols = 0 To DataGridView1.RowCount - 1
                  DataGridView1.Rows(DGVCols).Cells(e.ColumnIndex).Value = True
              Next
          End If
      Else
          If MsgBox("Do you want to uncheck all checkbox ?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Uncheck all") = MsgBoxResult.Yes Then
              For DGVCols = 0 To DataGridView1.RowCount - 1
                  DataGridView1.Rows(DGVCols).Cells(e.ColumnIndex).Value = False
              Next
          End If
      End If
  End If
  End Sub
  </code></pre>