using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnAdd_Click(object sender, EventArgs e)
{
float firstNumber = float.Parse(txtFirstNumber.Text);
float secondNumber = float.Parse(txtSecondNumber.Text);
float result = firstNumber + secondNumber;
lbResult.Text = "The anwser is: " + result.ToString();
}
private void btnSubtract_Click(object sender, EventArgs e)
{
float firstNumber = float.Parse(txtFirstNumber.Text);
float secondNumber = float.Parse(txtSecondNumber.Text);
float result = firstNumber - secondNumber;
lbResult.Text = "The anwser is: " + result.ToString();
}
private void btnDivide_Click(object sender, EventArgs e)
{
float firstNumber = float.Parse(txtFirstNumber.Text);
float secondNumber = float.Parse(txtSecondNumber.Text);
float result = firstNumber / secondNumber;
lbResult.Text = "The anwser is: " + result.ToString();
}
private void btnMultiply_Click(object sender, EventArgs e)
{
float firstNumber = float.Parse(txtFirstNumber.Text);
float secondNumber = float.Parse(txtSecondNumber.Text);
float result = firstNumber * secondNumber;
lbResult.Text = "The anwser is: " + result.ToString();
}
private void btnClear_Click(object sender, EventArgs e)
{
txtFirstNumber.Text = "Cleared!";
txtSecondNumber.Text = "Cleared!";
lbResult.Text = "Result: All fields cleared!";
}
}
}