RadioButton Control
Description
RadioButton controls present a set of two or more mutually exclusive choices to the operator.
While radio buttons and check boxes may appear to function similarly, there is an important difference: when a user selects a radio button, the other radio buttons in the same group cannot be selected as well.
Usage
RadioButton controls should be grouped together in a GroupBox control.
Each time the operator clicks on one of the radiobuttons in a group, the other buttons are deselected.
Use the Click event to determine if the operator clicked the radiobutton. Use the Checked property to determine if the user checked the box.
In some cases, it may be convenient to use one click event handler for all radiobuttons in a group.
You can use the Sender$ parameter to determine which radiobutton was clicked. Sender$ is the name of the control that sent the event.
Function frmSetup_OptionsClick(Sender$ As String)
Boolean checked
GGet frmSetup.Sender$.Checked, checked
If checked Then
Select Sender$
Case "RadioButton1":
g_Option1 = True
Case "RadioButton2":
g_Option2 = True
Send
EndIf
Fend
Setting RadioButton Appearance
Use the BorderStyle, ForeColor, BackColor, Font, Image, ImageAlign, and TextAlign properties to change the appearance of the radiobutton.
RadioButton Control Properties
Property | Description |
---|---|
BackColor | The background color for the control. Default: Control |
Checked | Sets whether the control is selected at runtime. Default: False |
Enabled | Sets whether the control is enabled at runtime. Default: True |
EventTaskType | The type of task used for events. Default: Normal |
Font | The font for the control text. Default: Microsoft Sans Serif 8.25 pt |
FontBold | The bold attribute for the current font Default: False |
FontItalic | The italic attribute for the current font Default: False |
FontName | The name for the current font Default: Microsoft Sans Serif |
FontSize | The size for the current font in points Default: 8.25 |
ForeColor | The foreground color for the control text. Default: ControlText |
Height | The height of the control in pixels. |
Image | The picture for the control. To delete, press the [Delete] key. Default: Empty |
ImageAlign | The picture alignment for the control. Default: MiddleCenter |
Left | The left coordinate of the control in pixels. |
Name | The name of the control. Default: RadioButtonXX |
TabIndex | The tab index of the control. |
Text | The text of the control. Default: Name of control |
TextAlign | Selects the text alignment. Default: Middle Left |
ToolTipText | The text used in the control’s tooltip. Default: Empty |
Top | The top coordinate of the control in pixels. |
Visible | Whether the control is visible or not at runtime. Default: True |
Width | The width of the control in pixels. |
RadioButton Control Events
Event | Description |
---|---|
Click | Executes when the user clicks the control with the mouse. |