Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement