|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class ctrlCalculator : System.Web.UI.UserControl
{
public delegate void CalculationInProgress(object sender, OperationEventArgs e);
public event CalculationInProgress Calculating;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnPerformOperation_Click(object sender, EventArgs e)
{
this.Calculating(this, new OperationEventArgs(Operation.Addition, Convert.ToDecimal(this.txtValue1.Text) + Convert.ToDecimal(this.txtValue2.Text)));
this.Calculating(this, new OperationEventArgs(Operation.Subtraction, Convert.ToDecimal(this.txtValue1.Text) - Convert.ToDecimal(this.txtValue2.Text)));
this.Calculating(this, new OperationEventArgs(Operation.Multiplicaiton, Convert.ToDecimal(this.txtValue1.Text) * Convert.ToDecimal(this.txtValue2.Text)));
this.Calculating(this, new OperationEventArgs(Operation.Division, Convert.ToDecimal(this.txtValue1.Text) / Convert.ToDecimal(this.txtValue2.Text)));
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Faraz is working as a Senior Software Engineer for a company located in Sharjah, UAE. He likes developing new applications with the latest technologies. Mostly reponsible for web applications using Microsoft.Net. He has done MCPD so far. Other than work play guitars, sing and play PSP.