Net-informations.com
SiteMap  | About    

RadioButton Control

A radio button or option button is a type of graphical user interface element that allows the user to choose only one of a predefined set of options. When a user clicks on a radio button, it becomes checked, and all other radio buttons with same group become unchecked

vb.net-radiobutton.jpg

The radio button and the check box are used for different functions. Use a radio button when you want the user to choose only one option. When you want the user to choose all appropriate options, use a check box. Like check boxes, radio buttons support a Checked property that indicates whether the radio button is selected.




Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        RadioButton1.Checked = True
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If RadioButton1.Checked = True Then
            MsgBox("You are selected Red !! ")
            Exit Sub
        ElseIf RadioButton2.Checked = True Then
            MsgBox("You are selected Blue !! ")
            Exit Sub
        Else
            MsgBox("You are selected Green !! ")
            Exit Sub
        End If
    End Sub

End Class




net-informations.com (C) 2016    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.