{
public partial
class WebForm1 : System.Web.UI.Page
{
protected void
Page_Load(object sender,
EventArgs e)
{
TextBox4.Focus();
}
protected void
Button1_Click(object sender,
EventArgs e)
{
double a = 0;
double b = 0;
if (string.IsNullOrEmpty(TextBox4.Text)
|| string.IsNullOrEmpty(TextBox1.Text))
{
Label5.Text =
"Please Enter Some Values";
Label5.ForeColor = System.Drawing.Color.Red;
}
else
{
Label5.Text =
"Addition Result is: " + Add(ref
a, ref b);
Label5.ForeColor = System.Drawing.Color.Green;
TextBox4.Text
= string.Empty;
TextBox1.Text
= string.Empty;
}
}
protected void
Button2_Click(object sender,
EventArgs e)
{
double a = 0;
double b = 0;
if (string.IsNullOrEmpty(TextBox4.Text)
|| string.IsNullOrEmpty(TextBox1.Text))
{
Label5.Text =
"Please Enter Some Values";
Label5.ForeColor = System.Drawing.Color.Red;
}
else
{
Label5.Text =
"Substraction Result is: " + Sub(ref
a, ref b);
Label5.ForeColor = System.Drawing.Color.Green;
TextBox4.Text
= string.Empty;
TextBox1.Text
= string.Empty;
}
}
protected void
Button3_Click(object sender,
EventArgs e)
{
double a = 0;
double b = 0;
if
(string.IsNullOrEmpty(TextBox4.Text) ||
string.IsNullOrEmpty(TextBox1.Text))
{
Label5.Text =
"Please Enter Some Values";
Label5.ForeColor = System.Drawing.Color.Red;
}
else
{
Label5.Text =
"Multiplication Result is: " + Mul(ref
a, ref b);
Label5.ForeColor = System.Drawing.Color.Green;
TextBox4.Text
= string.Empty;
TextBox1.Text
= string.Empty;
}
}
protected void
Button4_Click(object sender,
EventArgs e)
{
double a = 0;
double b = 0;
if (string.IsNullOrEmpty(TextBox4.Text)
|| string.IsNullOrEmpty(TextBox1.Text))
{
Label5.Text =
"Please Enter Some Values";
Label5.ForeColor = System.Drawing.Color.Red;
}
else
{
Label5.Text =
"Division Result is: " + Div(ref
a, ref b);
Label5.ForeColor = System.Drawing.Color.Green;
TextBox4.Text
= string.Empty;
TextBox1.Text
= string.Empty;
}
}
protected double
Add(ref double
a, ref double b)
{
a =
double.Parse(TextBox4.Text);
b =
double.Parse(TextBox1.Text);
return a + b;
}
protected double
Sub(ref double
a, ref double b)
{
a =
double.Parse(TextBox4.Text);
b =
double.Parse(TextBox1.Text);
return a - b;
}
protected double
Mul(ref double
a, ref double b)
{
a =
double.Parse(TextBox4.Text);
b =
double.Parse(TextBox1.Text);
return a * b;
}
protected double
Div(ref double
a, ref double b)
{
a =
double.Parse(TextBox4.Text);
b =
double.Parse(TextBox1.Text);
return a / b;
}
}
}