title: How to Get Checked row data from datagridview to Label
body: <p>I have some problem with my code. I'm using vb with mysql as database. i also have datagridview where the frist column is a checkedboxcolumn. All i want is: When the user check the checkbox some data will show automatically in the label.</p>
  
  <p>i have here my codes. Actually it is running. but the problem is the data that i first checked will show when i check 2nd checkbox.</p>
  
  
  
  <pre class="lang-vb prettyprint-override"><code>Dim counter As Integer = 0
  For Each oRow As DataGridViewRow In DataGridView1.Rows
      Dim isSelected As Boolean = Convert.ToBoolean(oRow.Cells("checkBoxColumn").Value)
      If Me.DataGridView1.Focused = True Then
          If isSelected = True Then
              counter += 1
              If counter = 1 Then
                  oRow.DefaultCellStyle.BackColor = Color.Red
                  Label17.Text = oRow.Cells("Book_ID").Value.ToString()
                  Label25.Text = oRow.Cells("Call_Number").Value.ToString()
                  Label21.Text = oRow.Cells("Title").Value.ToString()
  
                  If oRow.Cells("checkBoxColumn").Value = False Then
                      Label17.Text = ""
                      Label25.Text = ""
                      Label21.Text = ""
                  End If
              ElseIf counter = 2 Then
                  oRow.DefaultCellStyle.BackColor = Color.Red
                  Label20.Text = oRow.Cells("Book_ID").Value.ToString()
                  Label26.Text = oRow.Cells("Call_Number").Value.ToString()
                  Label19.Text = oRow.Cells("Title").Value.ToString()
                  oRow.Cells("checkBoxColumn").Value = False
                  MsgBox("You can Borrow 2 Books at a Time")
  
              End If
          End If
      End If
  Next
  </code></pre>