title: I want to add/remove label dynamically in c sharp
body: <p>Hi Every One,
               I want to remove label dynamically, when check box unchecked the label should be deleted and when check box is checked then label should be added.
    Here is my code:-</p>
  
  <pre><code>private void checkBox1_CheckedChanged(object sender, EventArgs e)
  {
      Label label = new Label();
      label.Name = "customLabel";
      label.AutoSize = true;
      label.Text = "Dynamically Generated Label";
      label.Location = new Point(50, 50);
      label.BringToFront();
      if (checkBox1.Checked)
      {
          this.Controls.Add(label);
      }
      else
      {
          label.Visible = false;
          //this.Controls.Remove(label);
      }
  }
  </code></pre>
  
  <p>but this code else statement is not working. Whenever I checked on check box then label created but whenever I unchecked check box then that label does not get removed. Someone help me Please.</p>
  
  <p>Thanks in advance.</p>