title: VB.NET: Adding listener to checkbox column
body: <p>I have a datagridview which has its first column as a datagridviewcheckboxcolumn.
  What I want is to detect when user checks/unchecks any of the checkboxes within first column in the datagridview so I have thought in two solutions:</p>
  
  <p>1)</p>
  
  <pre><code>    Private Sub OnDgvCellClick(sender As Object, _
                                  e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv.CellClick
  
      If e.ColumnIndex = 0 Then
          If Convert.ToBoolean(Me.dgv.Rows(e.RowIndex).Cells("chkcol").Value) = False then
          ' Do some stuff
          else
          ' Do some stuff
          End If
      End If
  End Sub
  </code></pre>
  
  <p>2) Iterate over all the datagridview rows, and add a listener for checkedchanged event on the all checkboxes of the first column.</p>
  
  <pre><code>Private Sub AddCheckedChangedListener()
      For i As Integer = 0 To Me.dgv.RowCount - 1
          AddHandler CType(Me.dgvDatos(0, i).Value, CheckBox).CheckedChanged, AddressOf OnCheckBoxCheckedChanged
      Next
  End Sub
  </code></pre>
  
  <p>Which one is the best?</p>