Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
Hi guys
I have to separate group of radio button in my form.
for example radiobutton1 & radiobutton2 in group 1 , radiobutton3 & radiobutton4 in group 2.
 
i want if user checked radiobutton 1 just radio button2 be unchecked not affected on radiobutton3 & radiobutton4 and if user checked radiobutton4 just radiobutton3 be unchecked not radiobutton1 & radiobutton2.
 
tnx for your responsibility.
Posted 16-Nov-12 22:01pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Put them in a GroupBox: http://msdn.microsoft.com/en-us/library/system.windows.forms.groupbox.aspx[^] - use a separate Group for each set of radio buttons,. and they will be independent of each other.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Try this one
 protected void rad1_CheckedChanged(object sender, EventArgs e)
    {
        if (rad1.Checked == true)
        {
            rad2.Checked = false;
        }
    }
    protected void rad2_CheckedChanged(object sender, EventArgs e)
    {
        if (rad2.Checked == true)
        {
            rad1.Checked = false;
        }
    }
    protected void rad3_CheckedChanged(object sender, EventArgs e)
    {
        if (rad3.Checked == true)
        {
            rad4.Checked = false;
        }
    }
    protected void rad4_CheckedChanged(object sender, EventArgs e)
    {
        if (rad4.Checked == true)
        {
            rad3.Checked = false;
        }
    }
hope It will be helpfull for You.
Thanks
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 680
1 OriginalGriff 379
2 Manas Bhardwaj 350
3 Abhinav S 293
4 Sampath Lokuge 245
0 Sergey Alexandrovich Kryukov 7,647
1 OriginalGriff 4,287
2 Peter Leow 3,681
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 17 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid