So, I was playing a bit with adding and removing tabs. I have a tabControl and a Add and Remove button. Then I wanted to be able to have controls on each new tab. And then it occured to me that I have never done something like this...
How can I get a new Listview or textbox on each new tab?
I did do some searching and Googling, but I'm not finding what I'm looking for... maybe I'm using the wrong keyword.
Thanks in advance. :)
Adding listview control to new tabpage
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Scott LysleRank #49 · 31K reputationPosted Jul 2, 2008, 11:07 PM EDT
// Add
private void button1_Click(object sender, EventArgs e)
{
TextBox t = new TextBox();
t.Name = "tNew";
t.Location = new Point(10, 10);
t.Text = "New";
tabControl1.TabPages[0].Controls.Add(t);
}
// Remove
private void button2_Click(object sender, EventArgs e)
{
foreach (Control c in tabControl1.TabPages[0].Controls)
{
if (c.Name == "tNew")
tabControl1.TabPages[0].Controls.Remove(c);
}
}
NeCroFire82 reputationPosted Jul 4, 2008, 12:33 AM EDT
Many Thanks. :)