Hello,
Hope this will help you.. I have a windows form in that Tabcontrol1 is placed. The list box has five values "one", "two","three","four","five". Whenever I select an item in the list box the code will check for the corresponding tabpage is opened or not. If tabpage is not there it will create a tab page and add it to TabPage1. Otherwise if the page is already there it will select the particular page and return. Initially set the tabpages to 0. Hope this helps you to meet your requirement..
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
foreach (TabPage tp in tabControl1.TabPages)
{
if (tp.Text == listBox1.SelectedItem.ToString())
{
tabControl1.SelectedTab = tp;
return;
}
}
TabPage newPage = new TabPage(listBox1.SelectedItem.ToString());
tabControl1.TabPages.Add(newPage);
}