Programme of RadioButton and CheckBox Controls

add a new form in the project and write the below code by designing the form as following :



Code under “Show Selected Radio Button” button’s click event


if (radioButton1.Checked)
   MessageBox.Show("Radio Button1 is selected"); else if (radioButton2.Checked)
   MessageBox.Show("Radio Button2 is selected"); else if (radioButton3.Checked)
   MessageBox.Show("Radio Button3 is selected");
   

Code under “Show Selected Check Box’s” button’s click event:


    if (checkBox1.Checked)
   MessageBox.Show("Check Box1 is selected");
if (checkBox2.Checked)
   MessageBox.Show("Check Box2 is selected");
if (checkBox3.Checked)
   MessageBox.Show("Check Box3 is selected");