Is there an easy way to interate through a group of radio buttons (9 of
'em) contained within a group box in VS2005. I really don't want to have
to evaluate each one...
You can write one sub/function to handle them all. Set the .Tag value to the
Button number.
Here is a horrible example:
Private Sub RadioButtons_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, _
RadioButton2.CheckedChanged, RadioButton3.CheckedChanged, _
RadioButton4.CheckedChanged, RadioButton5.CheckedChanged, _
RadioButton6.CheckedChanged, RadioButton7.CheckedChanged, _
RadioButton8.CheckedChanged, RadioButton9.CheckedChanged
Debug.Print(sender.tag)
RadioButton1.BackColor = Drawing.SystemColors.Control
RadioButton2.BackColor = Drawing.SystemColors.Control
RadioButton3.BackColor = Drawing.SystemColors.Control
RadioButton4.BackColor = Drawing.SystemColors.Control
RadioButton5.BackColor = Drawing.SystemColors.Control
RadioButton6.BackColor = Drawing.SystemColors.Control
RadioButton7.BackColor = Drawing.SystemColors.Control
RadioButton8.BackColor = Drawing.SystemColors.Control
RadioButton9.BackColor = Drawing.SystemColors.Control
Select Case sender.tag
Case 1
RadioButton1.BackColor = Color.Red
Case 2
RadioButton2.BackColor = Color.Red
Case 3
RadioButton3.BackColor = Color.Red
Case 4
RadioButton4.BackColor = Color.Red
Case 5
RadioButton5.BackColor = Color.Red
Case 6
RadioButton6.BackColor = Color.Red
Case 7
RadioButton7.BackColor = Color.Red
Case 8
RadioButton8.BackColor = Color.Red
Case 9
RadioButton9.BackColor = Color.Red
End Select
End Sub