Shane Partridge
Visual Basic 2013
The Code
Public Class Form87
'## Radio Buttons - Visual Basic ##
'## In Visual Basic 2013, the Radio Buttons operate differently from CheckBoxes ##
'## While the CheckBoxes work independently and allow users to select ##
'## One or More Items. The Radio Buttons are Mutually Exclusive. ##
'## It means that the User can only choose One Item ##
'## out of a Number of Choices from the Radio Buttons ##
'## Group Boxes can be used to contain Radio Buttons(Menu) in [Form1.vb (Design)] Mode. ##
'## Program is constructed by the If... Then... Else decision making Format ##
'## RadioButton#.Checked = False : Clears Value of Radio Button ##
Dim Tcolor As String
Private Sub Button1Radio_Click(sender As Object, e As EventArgs) Handles Button1.Click
If RadioButton1.Checked Then
Tcolor = "Red Color"
Label1.ForeColor = Color.Red
ElseIf RadioButton2.Checked Then
Tcolor = "Green Color"
Label1.ForeColor = Color.Green
Else
Tcolor = "Yellow Color"
Label1.ForeColor = Color.Yellow
End If
'## Assign Tcolor Value to Label1.Text ##
Label1.Text = Tcolor
End Sub
Private Sub Button3ClearRadio_Click(sender As Object, e As EventArgs) Handles Button3.Click
'## Clear RadioButton ##
RadioButton1.Checked = False
RadioButton2.Checked = False
RadioButton3.Checked = False
End Sub
Private Sub Button2CloseProgram_Click(sender As Object, e As EventArgs) Handles Button2.Click
'## Close Program ##
Form81.Show()
Me.Hide()
End Sub
End Class