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)



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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100