Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If RadioButton1.Checked = True Then Me.BackColor = Color.Yellow Exit Sub ElseIf RadioButton2.Checked = True Then Me.BackColor = Color.Blue Exit Sub Else Me.BackColor = Color.Red End If End Sub
checked = True
here is our event for our RadioButton as it toggles on and off. When we check RadioButton1, it will have a background color of Yellow ( Me.BackColor = Color.Yellow
. The "Me" here indicates that we are referring to Form1. Next, When we check RadioButton2, it will have a background color of Blue ( Me.BackColor = Color.Blue
. Otherwise, it will have a background color of Red.