Wednesday, December 4, 2013

selectio of two radio buttons in windows forms

1. take two radio buttons
And two checkboxes
If radiobutton1 pressed then automatically it checks the first checkbox and enters that value to textbox
In the same way second also. If two radio buttons checked then place two values in textbox

Code it in windows forms

use pannels


private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
          
            if (radioButton1.Checked == true)
            {
                checkBox1.Checked = true;
                textBox1.Text += checkBox1.Text;
            }
            else
            {
                checkBox1.Checked = false;
            }
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
        
            if (radioButton2.Checked == true)
            {
                checkBox2.Checked = true;
                textBox1.Text += checkBox2.Text;
            }
            else
            {
                checkBox2.Checked = false;
            }
        }

No comments:

Post a Comment