I am generating a RichTextBox and a button with another button. When the generated button is clicked, I want to delete the RichTextBox and itself.
static int i = 1;
private void generate_Click(object sender, EventArgs e)
{
RichTextBox text = new RichTextBox();
Button delete = new Button();
this.Controls.Add(text);
this.Controls.Add(delete);
i++;
}