WebRadioGroup.SelectedIndex

From Xojo Documentation

Revision as of 22:19, 11 January 2022 by Gperlman (talk | contribs) (Notes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Method

WebRadioGroup.SelectedIndex() As Integer

New in 2021r1

Supported for all project types and targets.

Returns the row of the selected radio button.

Notes

Use SelectedCell in the SelectionChanged event to determine which radio button was clicked. Since SelectedCell is a Pair, the Left property represents the row index and the Right property represents the column index. The indexes are zero-based.

A value of -1 means there is no selection. You can assign this value to remove the selection as well.

Sample Code

This code selects a radio button, which has the effect of de-selecting all the other radio buttons in the group:

RadioGroup1.SelectedIndex = 1

Use SelectedIndex in the ValueChanged event handler to determine which radio button was pressed.

For example, the following code in the ValueChanged event handler will display a message based upon which radio button is pressed:

Select Case Me.SelectedIndex
Case 0 // Row 1
MessageBox("You clicked the top button.")
Case 1 // Row 2
MessageBox("You clicked the bottom button.")
End Select

See Also

WebRadioButton class.