What do you want to happen if the user tries to check a fifth box? Do you want to prevent it or do you want to uncheck one of the checked ones? I'm guessing the former, so here's a way to disable any unchecked boxes when the maximum number have already been checked and re-enable them if one is unchecked:
Code:
Private Const MAX_CHECKED_BOX_COUNT As Integer = 4
Private Sub CheckBoxes_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox6.CheckedChanged,
CheckBox5.CheckedChanged,
CheckBox4.CheckedChanged,
CheckBox3.CheckedChanged,
CheckBox2.CheckedChanged,
CheckBox1.CheckedChanged
'Get all the CheckBoxes.
Dim checkBoxes = Controls.OfType(Of CheckBox)().ToArray()
'Get the number of checked CheckBoxes.
Dim checkedBoxCount = checkBoxes.Count(Function(cb) cb.Checked)
'Unchecked CheckBoxes should be enabled if and only if the number of checked CheckBoxes is less than the maximum number allowed.
Dim enableUncheckedBoxes = checkedBoxCount < MAX_CHECKED_BOX_COUNT
'Get the unchecked CheckBoxes.
Dim uncheckedBoxes = checkBoxes.Where(Function(cb) Not cb.Checked)
'Enable or disable the unchecked CheckBoxes as appropriate.
For Each uncheckedBox In uncheckedBoxes
uncheckedBox.Enabled = enableUncheckedBoxes
Next
End Sub