Hi,
see this VB.NET code:
Private Sub checkBox_CheckedChanged(sender As Object, e As EventArgs)
If DirectCast(sender, CheckBox).Checked = False Then
Return
End If
For Each ctrl As Control In DirectCast(sender, CheckBox).Parent.Controls
If TypeOf ctrl Is CheckBox AndAlso ctrl <> sender Then
DirectCast(ctrl, CheckBox).Checked = False
End If
Next
End Sub
You just need to add event handlers for your three checkboxes to the above code which is similar to the solution of Amy, but works without having a collection of checkboxes.
Use this for adding the event handlers:
Me.checkBox1.CheckedChanged += New System.EventHandler(Me.checkBox_CheckedChanged)
Me.checkBox2.CheckedChanged += New System.EventHandler(Me.checkBox_CheckedChanged)
Me.checkBox3.CheckedChanged += New System.EventHandler(Me.checkBox_CheckedChanged)