title: Disable other checkboxes in a GroupBox when two are checked
body: <pre><code> Private Sub AllBoxes_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged, CheckBox2.CheckedChanged, CheckBox3.CheckedChanged, CheckBox4.CheckedChanged, CheckBox5.CheckedChanged, CheckBox6.CheckedChanged
  
      Dim qty As Int16 = 0
      Dim cb As CheckBox
  
  
      For Each cb In GroupBox8.Controls.OfType(Of CheckBox)
          If cb.Checked Then
              qty += 1
          End If
      Next
  
      If qty = 2 Then
  
          For Each cb In GroupBox8.Controls.OfType(Of CheckBox)
              If Not cb.Checked Then
                  cb.Enabled = False
              End If
          Next
      Else
  
          For Each cb In GroupBox8.Controls.OfType(Of CheckBox)
              cb.Enabled = True
          Next
      End If
  End Sub
  </code></pre>
  
  <p>it just doesn't work. The groupbox's name is groupbox8 and it has 6 checkboxes on it. I need to select two checkboxes.</p>