Arthmetic Operation

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

1.

User Interface

2. Code for Each controls


private void btnAdd_Click(object sender, EventArgs e)
{
int numb1, numb2;
int result1;
String data1 = txtInput1.Text;
string data2 = txtInput2.Text;
numb1 = Int32.Parse(data1);
numb2 = Int32.Parse(data2);
result1 = numb1 + numb2;
lblResult.Text = lblResult1.ToString();
}

private void btnSubtract_Click(object sender, EventArgs e)


{
int numb1, numb2;
int result1;
String data1 = txtInput1.Text;
string data2 = txtInput2.Text;
numb1 = Int32.Parse(data1);
numb2 = Int32.Parse(data2);
result1 = numb1 - numb2;
lblResult.Text = result1.ToString();
}

private void btnDivided_Click(object sender, EventArgs e)


{
int numb1, numb2;
double result1;
String data1 = txtInput1.Text;
string data2 = txtInput2.Text;
numb1 = Int32.Parse(data1);
numb2 = Int32.Parse(data2);
result1 = numb1 / numb2;
lblResult.Text = result1.ToString();
}

private void btnMultiply_Click(object sender, EventArgs e)


{
int numb1, numb2;
int result1;
String data1 = txtInput1.Text;
string data2 = txtInput2.Text;
numb1 = Int32.Parse(data1);
numb2 = Int32.Parse(data2);
result1 = numb1 * numb2;
lblResult.Text = result1.ToString();
}

private void btnReset_Click(object sender, EventArgs e)


{
txtInput1.Text = "";
txtInput2.Text = "";
lblResult.Text = "";
}

private void btnExit_Click(object sender, EventArgs e)


{
Application.Exit();
}

You might also like