ktopchiev

Win Form App Sumator

Oct 20th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace Sumator
  12. {
  13.     public partial class FormCalculate : Form
  14.     {
  15.         public FormCalculate()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void textBox3_TextChanged(object sender, EventArgs e)
  21.         {
  22.  
  23.         }
  24.  
  25.         private void buttonCalculate_Click(object sender, EventArgs e)
  26.         {
  27.             try
  28.             {
  29.                 var num1 = decimal.Parse(this.textBox1.Text);
  30.                 var num2 = decimal.Parse(this.textBox2.Text);
  31.                 var sum = num1 + num2;
  32.                 textBoxSum.Text = sum.ToString();
  33.             }
  34.             catch (Exception)
  35.             {
  36.                 textBoxSum.Text = "error";
  37.             }
  38.         }
Add Comment
Please, Sign In to add comment