SpongeBob SquarePants
SpongeBob SquarePants

Reputation: 1055

Unable to select more than 1 radio button

I have 4 radio buttons, r1, r2, r3, r4. These four radio buttons are in a group box.

r1 and r2 for asking the gender of person.

r1 for Male , r2 for Female

r3 and r4 for asking whether the user would like to continue.

r3 for Yes , r4 for No.

When I click r1 , r3 becomes unchecked and vice versa. Similar is the case with r2 , r4. So at a time I can check only one radio button. How can I get around this problem . The groupbox is essential so I cannot remove it.

Upvotes: 0

Views: 8208

Answers (5)

Towhid
Towhid

Reputation: 2094

For radiobutton r1 and r2 use GroupName = "Gender"

For radiobutton r3 and r4 use GroupName = "ContinueOrNot"

Upvotes: 1

M.Medhat
M.Medhat

Reputation: 101

Group Box = you have to select only one radio button. Use two Group Boxes instead, one for the gender and one for asking whether to continue.

Upvotes: 1

SwissGuy
SwissGuy

Reputation: 565

You can only select 1 Radiobutton in a Groupbox if there is no other subcontrol like Panel
So you have to create a Groupbox for r1 and r2

and a separate for r3 and r4

Upvotes: 1

Bobby
Bobby

Reputation: 11576

Radiobuttons are grouped by their parent-control. It would be sufficient to re-group them in a Panel.

Current Layout:

Groupbox
    RadioButton
    RadioButton
    RadioButton
    RadioButton

New Layout:

Groupbox
    Panel
        RadioButton
        RadioButton
    Panel
        RadioButton
        RadioButton

Upvotes: 4

Oded
Oded

Reputation: 499382

Make sure the gender radio buttons and the yes/no radio buttons do not belong to the same radio button group - they need to be separate radio button lists.

Upvotes: 1

Related Questions