To implement this concept you need to follow the below steps :
Step1 :
On the File menu, click New
Project. Select Windows Forms Application as
your project type.
Design the Form using controls from Toolbox.
Step2:
Now open the Form.cs page and write the following source code.
Form1.cs Code :
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void clear()
{
textBox1.Text = String.Empty;
textBox2.Text = String.Empty;
}
private void
button1_Click(object sender, EventArgs e)
{
double num1, num2;
double result;
num1 = Convert.ToDouble(textBox1.Text);
num2 = Convert.ToDouble(textBox2.Text);
result = num1 + num2;
MessageBox.Show("The
Result is " + result.ToString());
}
private void
button2_Click(object sender, EventArgs e)
{
double num1, num2, result;
num1 = Convert.ToDouble(textBox1.Text);
num2 = Convert.ToDouble(textBox2.Text);
result = num1 - num2;
MessageBox.Show("The
Result is " + result.ToString());
}
private void
button4_Click(object sender, EventArgs e)
{
double num1, num2, result;
num1 = Convert.ToDouble(textBox1.Text);
num2 = Convert.ToDouble(textBox2.Text);
result = num1 * num2;
MessageBox.Show("The
Result is " + result.ToString());
}
private void
button3_Click(object sender, EventArgs e)
{
double num1, num2, result;
num1 = Convert.ToDouble(textBox1.Text);
num2 = Convert.ToDouble(textBox2.Text);
result = num1 / num2;
MessageBox.Show("The
Result is " + result.ToString());
}
}
}
Step3:
Now build the Solution and Debug it for the output.
Output:
No comments:
Post a Comment