Radio button






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

namespace WindowsFormsApplication1
{
    public partial class radiobutton : Form
    {
        public radiobutton()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int a = Convert.ToInt32(textBox1.Text);
            int b = Convert.ToInt32(textBox2.Text);
            int c;
            if (radioButton1.Checked == true)
            {
                c = a + b;
                textBox3.Text = c.ToString();
            }
            if (radioButton2.Checked == true)
            {
                c = a - b;
                textBox3.Text = c.ToString();
            }
            if (radioButton3.Checked == true)
            {
                c = a * b;
                textBox3.Text = c.ToString();
            }
            if (radioButton4.Checked == true)
            {
                c = a / b;
                textBox3.Text = c.ToString();
            }
        }
    }
}


No comments:

Post a Comment

Techzmatrix