JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Getting a Radio Button's State

You can check if a radio button is selected or not with the Checked property (formerly the Value property in VB6 and earlier). Radio buttons' Checked property only has two settings: True if the button is selected, and False if not.

Here's an example showing how to determine whether a radio button is selected or not. In this case, we display a message in a message box that indicates if a radio button, RadioButton1, is selected or not:

Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
    If RadioButton1.Checked Then
        MsgBox ("The Radio Button is selected.")
    Else
        MsgBox ("The Radio Button is not selected.")
    End If
End Sub

And that's all there is to it.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor