Advertisement
AalborgHTX

Lokal vs global deklaration

Dec 6th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 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 Deklaration
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         string globalNavn;
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         private void button1_Click(object sender, EventArgs e)
  22.         {
  23.             string lokalNavn = "";
  24.  
  25.             globalNavn = globalNavn + textBox1.Text;
  26.             lokalNavn = lokalNavn + textBox1.Text;
  27.  
  28.             label1.Text = globalNavn;
  29.             label2.Text = lokalNavn;
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement