AalborgHTX

Metoder uden parametre

Jan 22nd, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 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 Metoder1
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         int tal1;
  21.         int tal2;
  22.         int sum;
  23.  
  24.         private void btnKnap_Click(object sender, EventArgs e)
  25.         {
  26.             ReadNumbers();
  27.             AddUp();
  28.             WriteOut();
  29.         }
  30.  
  31.         void ReadNumbers()
  32.         {
  33.             tal1 = int.Parse(txtInput1.Text);
  34.             tal2 = int.Parse(txtInput2.Text);
  35.         }
  36.  
  37.         void AddUp()
  38.         {
  39.             sum = tal1 + tal2;
  40.         }
  41.  
  42.         void WriteOut()
  43.         {
  44.             lblUd.Text = sum.ToString();
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment