Onlc2

From Wikireedia
Jump to: navigation, search

using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls;

namespace UsesMathDLL { /// <summary> /// Summary description for WebForm1. /// </summary> public class WebForm1 : System.Web.UI.Page { protected System.Web.UI.WebControls.TextBox txtNum1; protected System.Web.UI.WebControls.TextBox txtNum2; protected System.Web.UI.WebControls.Label lblResult; protected System.Web.UI.WebControls.Button btnAdd; protected System.Web.UI.WebControls.Button btnSubtract; protected System.Web.UI.WebControls.Button btnMultiply; protected System.Web.UI.WebControls.Button btnDivide; //Call the Math DLL located at c:\Math Math.cMath GetMathFunctions=new Math.cMath(); //two integers as parameters int Num1; int Num2;


private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here }

#region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); }

/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click); this.btnSubtract.Click += new System.EventHandler(this.btnSubtract_Click); this.btnMultiply.Click += new System.EventHandler(this.btnMultiply_Click); this.btnDivide.Click += new System.EventHandler(this.btnDivide_Click); this.Load += new System.EventHandler(this.Page_Load);

} #endregion

private void btnAdd_Click(object sender, System.EventArgs e) { Num1=Convert.ToInt32(txtNum1.Text); Num2=Convert.ToInt32(txtNum2.Text); lblResult.Text=Convert.ToString(GetMathFunctions.AddMe(Num1,Num2));

}

private void btnSubtract_Click(object sender, System.EventArgs e) { Num1=Convert.ToInt32(txtNum1.Text); Num2=Convert.ToInt32(txtNum2.Text); lblResult.Text=Convert.ToString(GetMathFunctions.SubtractMe(Num1,Num2));

}

private void btnMultiply_Click(object sender, System.EventArgs e) { Num1=Convert.ToInt32(txtNum1.Text); Num2=Convert.ToInt32(txtNum2.Text); lblResult.Text=Convert.ToString(GetMathFunctions.MultiplyMe(Num1,Num2)); }

private void btnDivide_Click(object sender, System.EventArgs e) { Num1=Convert.ToInt32(txtNum1.Text); Num2=Convert.ToInt32(txtNum2.Text); lblResult.Text=Convert.ToString(GetMathFunctions.DivideMe(Num1,Num2)); }


} }

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox