SHARE
TWEET

Untitled

a guest Feb 20th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Windows.Forms;
  4.  
  5. namespace WindowsFormsApplication1
  6. {
  7.     public partial class Form1 : Form
  8.     {
  9.         public Session ses = new Session();
  10.         public Form1()
  11.         {
  12.             InitializeComponent();
  13.            
  14.         }
  15.  
  16.         private void button1_Click(object sender, EventArgs e)
  17.         {
  18.             Form faux = new Form();
  19.             TextBox tex = new TextBox();
  20.             tex.Text="0";
  21.             faux.Controls.Add(tex);
  22.             ses.controles.Add(tex);
  23.             faux.Show();
  24.         }
  25.  
  26.         private void button2_Click(object sender, EventArgs e)
  27.         {
  28.             for (int i = 0; i < ses.controles.Count; i++)
  29.             {
  30.                 ses.controles[i].Text = ses.controles[i].Text + "<X>";
  31.             }
  32.         }
  33.  
  34.     }
  35.  
  36.     public class Session
  37.     {
  38.         public List<Control> controles{get;set;}
  39.         public Session()
  40.         {
  41.             controles = new List<Control>();
  42.         }
  43.     }
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top