I am trying to add a TabPage and inside it a Textbox. The problem is if I have more TabPages the content of the TextBox is always the last added and not the selected TabPage.

EDIT 3 //
public partial class Form1 : Form
{
int tabcount = 0;
TextBox TextE;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// Create a new textbox to add to each control
TextE = new TextBox();
// Fill the tabpage
TextE.Dock = DockStyle.Fill;
TextE.Multiline = true;
// Create new tab page and increment the text of it
TabPage tab = new TabPage();
tab.Text = "Tab" + tabcount.ToString();
// Add Textbox to the tab
tab.Controls.Add(TextE);
// Add tabpage to tabcontrol
tabControl1.Controls.Add(tab);
tabcount++;
}
private void button2_Click(object sender, EventArgs e)
{
// Text content to messagebox...
MessageBox.Show(TextE.Text);
}
}