Thursday, 4 April 2013

Example of RadioButton and CheckBox Control






using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WinForms7
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

          private void button1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
                MessageBox.Show("Radiobutton1 is selected");
            else if
                (radioButton2.Checked)
                MessageBox.Show("Radiobutton2 is selected");
            else if
                (radioButton3.Checked)
                MessageBox.Show("Radiobutton3 is selected");
          }

        private void button2_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
                MessageBox.Show("Checkbox1 is selected");
            if (checkBox2.Checked)
                MessageBox.Show("Checkbox2 is selected");
            if (checkBox3.Checked)
                MessageBox.Show("Checkbox3 is selected");
        }
       
    }
}

No comments:

Post a Comment