Guest User

Untitled

a guest
Jul 29th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 1.94 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7.  
  8. public partial class _Default : System.Web.UI.Page
  9. {
  10.     protected void Page_Load(object sender, EventArgs e)
  11.     {
  12.  
  13.     }
  14.     protected void btn_bereken_Click(object sender, EventArgs e)
  15.     {
  16.         int getal1 = Convert.ToInt16(tb_getal1.Text);
  17.         int getal2 = Convert.ToInt16(tb_getal2.Text);
  18.  
  19.         if (tb_operator.Text == "*")
  20.         {
  21.             tb_uitkomst.Text = (getal1 * getal2).ToString();
  22.         }
  23.  
  24.         else if (tb_operator.Text == "+")
  25.         {
  26.             tb_uitkomst.Text = (getal1 + getal2).ToString();
  27.         }
  28.  
  29.         else if (tb_operator.Text == "-")
  30.         {
  31.             tb_uitkomst.Text = (getal1 - getal2).ToString();
  32.         }
  33.  
  34.         else if (tb_operator.Text == "/")
  35.         {
  36.             tb_uitkomst.Text = (getal1 / getal2).ToString();
  37.         }
  38.  
  39.         else
  40.         {
  41.             tb_uitkomst.Text = "Geen operator ingevuld, probeer opnieuw.";
  42.         }
  43.     }
  44.     protected void btn_bereken2_Click(object sender, EventArgs e)
  45.     {
  46.         int getal3 = Convert.ToInt16(tb_getal3.Text);
  47.         int getal4 = Convert.ToInt16(tb_getal4.Text);
  48.  
  49.  
  50.         switch(tb_operator2.Text)
  51.         {
  52.             case "*":
  53.                 tb_uitkomst2.Text = (getal3 * getal4).ToString();
  54.                 break;
  55.                
  56.             case "+":
  57.                 tb_uitkomst2.Text = (getal3 + getal4).ToString();
  58.                 break;
  59.  
  60.             case "-":
  61.                 tb_uitkomst2.Text = (getal3 - getal4).ToString();
  62.                 break;
  63.  
  64.             case "/":
  65.                 tb_uitkomst2.Text = (getal3 / getal4).ToString();
  66.                 break;
  67.                                    
  68.             default:
  69.                 tb_uitkomst2.Text = "Geen operator ingevuld, probeer opnieuw";
  70.                 break;
  71.  
  72.  
  73.         }
  74.     }
  75. }
Add Comment
Please, Sign In to add comment