title: Adding checkbox dynamically
body: <pre><code>public Form1 f1 = new Form1();
  int p = 150;
  int q = 100;
  
  public void add()
  {
      //CheckBox c = new CheckBox();
      //c.Location = new Point(p, q);
  
      //c.Text = f1.sub[0];
      //this.Controls.Add(c);
  
      CheckBox chkBox = new CheckBox();
      chkBox.Location = new Point(p, q);
      chkBox.Text = "Checked";
      chkBox.Checked = false;
      chkBox.CheckState = CheckState.Checked;
      chkBox.CheckedChanged += new EventHandler(chkBox_CheckedChanged);//
      this.Controls.Add(chkBox);
      chkBox.Text = f1.sub[1];//The problem is here... whatever value I supply
                              // to sub[] it gives the below mentioned error
  }
  </code></pre>
  
  <p>Index was out of range. Must be non-negative and less than the size of the collection.
  Parameter name: index</p>
  
  <p>Here <code>sub[]</code> is a <code>list&lt;string&gt;</code> in form1 which has 5 values...</p>