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. :)
Loading
NeCroFirePosted Jul 4, 2008, 4:33 AM
Many Thanks. :)
Scott LyslePosted Jul 3, 2008, 3:07 AM
// 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);
}
}