Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How do I group Windows Form radio buttons, or where I can find the RadioButton.GroupName Property?

What I have tried:

............................................
Posted
Updated 11-Jun-18 12:36pm
Comments
Mohibur Rashid 11-Jun-18 18:28pm    
We won't tell you unless you offer more information
Ahmed Taha 11-Jun-18 18:35pm    
I have two radion buttons Male And female and I have a problem with retrieving checked radio button from the database. I searched the internet and many people were saying RadioButton.GroupName Property can solve this problem, but I can not find this property =.
Mohibur Rashid 11-Jun-18 19:28pm    
First of all, show us some code and also tell us what language and tools are you using.
Ahmed Taha 11-Jun-18 19:30pm    
I am using C# with visual studio.
Which part of the code?
I have two radion buttons connected to data binding-Sex.

1 solution

In Windows Forms, radio buttons are usually grouped using a GroupBox control.
Try to put a few radio buttons in a groupbox on a test form, at runtime you will see that only one button can be activated at a time in a single group box. There is no GroupName property, at least none that I know of.
You can search for "winforms groupbox radio buttons" and get a load of links to example usages.
 
Share this answer
 
Comments
Ahmed Taha 11-Jun-18 19:17pm    
I have the two radio buttons inside a group box and when I check one the other one will uncheck. The problem is when I assign both radio button in the data bindings to (BindingSource - Sex) and i try to retrieve I do not get any button checked.
phil.o 11-Jun-18 20:07pm    
Maciej Los 12-Jun-18 2:20am    
Why both?
Maciej Los 12-Jun-18 2:18am    
5ed!
phil.o 12-Jun-18 4:48am    
Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900