Click here to Skip to main content
15,921,179 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
How to use RadioButtons and compare them?
Posted

I think the following code will help you if you are trying to choose 1 value such as male or femal using the radio button.
C#
if(radioButton1.Checked== true)
{
 // put your code here, such as
string sex = "Male";

}
if(radioButton2.checked==true)
{
string sex ="Female";
}
 
Share this answer
 
Comments
fjdiewornncalwe 23-Feb-13 11:14am    
My 2. Correct logically, but better written like this:
string sex = radioButton1.Checked ? "Male" : "Female";
How to use RadioButton
You can easily find a number of results on
Google

and what you want to compare please clearify.
 
Share this answer
 
Hi buddy..

if you want to use two radio control like for Male female...

for it just put the both control on a container control like panel or group box...it will select single at once......and want more then clarify that actually what you want to do in your project....
 
Share this answer
 

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