using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { Label1.Text = TextBox1.Text; } protected void Button2_Click(object sender, EventArgs e) { /* * TextBox4.Text = Convert.ToString( Convert.ToInt32(TextBox2.Text) * Convert.ToInt32(TextBox3.Text)); */ try { int arv1 = Convert.ToInt32(TextBox2.Text); int arv2 = Convert.ToInt32(TextBox3.Text); int vastus = -1; string tehe = DropDownList1.Text; if (tehe.Equals("+")) { vastus = arv1 + arv2; } if (tehe.Equals("-")) { vastus = arv1 - arv2; } if (tehe.Equals("x")) { vastus = arv1 * arv2; } if (tehe.Equals("/")) { vastus = arv1 / arv2; } TextBox4.Text = vastus.ToString(); } catch (Exception ex) { TextBox4.Text = "Tekkis viga: " + ex.ToString(); } } }