Below is the windows form application which have four radio buttons. Each having its speciality. Let's see this with grammatically.
Below is the design view of the project:
Here is the source code for the above project:
Form1.cs:
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 basic_opr_radio_btn_demo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void radioButton5_CheckedChanged(object sender, EventArgs e)
{
int a = Int32.Parse(textBox4.Text);
int b = Int32.Parse(textBox5.Text);
int c = 0;
if (radioButton5.Checked)
c = a + b;
textBox6.Text = c.ToString();
}
private void radioButton6_CheckedChanged(object sender, EventArgs e)
{
int a = Int32.Parse(textBox4.Text);
int b = Int32.Parse(textBox5.Text);
int c = 0;
if (radioButton6.Checked)
c = a - b;
textBox6.Text = c.ToString();
}
private void radioButton7_CheckedChanged(object sender, EventArgs e)
{
int a = Int32.Parse(textBox4.Text);
int b = Int32.Parse(textBox5.Text);
int c = 0;
if (radioButton7.Checked)
c = a * b;
textBox6.Text = c.ToString();
}
private void radioButton8_CheckedChanged(object sender, EventArgs e)
{
int a = Int32.Parse(textBox4.Text);
int b = Int32.Parse(textBox5.Text);
int c = 0;
if (radioButton8.Checked)
c = a / b;
textBox6.Text = c.ToString();
}
}
}
Program.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace basic_opr_radio_btn_demo
{
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Comments
Post a Comment