.NET 2
// dynamic textbox adding
myTextBox = new TextBox();
this.Controls.Add(myTextBox);
// ... some code, finally
// dynamic textbox removing
myTextBox.Dispose();
// this.Controls.Remove(myTextBox); ?? is this needed
Little explanation
- Surely, if I Dispose a control I will not see it anymore, but anyway, will remain a "Nothing" in the parent controls collection?
- need I also, like MSDN recommends, remove all handlers from the control?