title: How to save dynamically created textboxes and their values
body: <p>I am working on project in which I need to save dynamically created textboxes(I need the textboxes' data to appear when I run the application a second time).</p>
  
  <p>This is my code:</p>
  
  <pre><code>public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
      }
  
      static int itimes = 0;
      static int i = 0;
      public void textboxadd()
      {            
          TextBox txt = new TextBox();
          txt.Name = "Name" + i;
  
          if (i == 0)
          {
              Point p = new Point(6, 43);
              txt.Location = p;
          }
          else
          {
              Point p = new Point(6, 43 + 32 * i); 
              txt.Location = p;
          }
  
          txt.Size = new System.Drawing.Size(236, 26);
  
          Properties.Settings.Default.name1 = txt.Text;
          Properties.Settings.Default.Save();
  
  
          groupBox1.Controls.Add(txt);
  
          i++;           
      }
  
      private void button1_Click(object sender, EventArgs e)
      {            
          textboxadd();
          int gps = groupBox1.Size.Height;
          if (itimes == 0)
          {
              itimes++;
          }
          else
          {
              groupBox1.Size = new System.Drawing.Size(248, gps + 32);
          }
      }
  }
  </code></pre>
  
  <p>If you don't understand my question please ask and I will answer.</p>
  
  <p>Thank you for your help!!!!</p>