I have two tabs that I know the names of (design and picture) and I want to remove every other tab in the tab control. (I want to remove all the tabpages excepts the ones I know the names of.)
I have searched the internet and I found:
string tabToRemove = "tabPageName";
for (int i = 0; i < tabControlMain.TabPages.Count; i++)
{
if (tabControlMain.TabPages[i].Name.Equals(tabToRemove, StringComparison.OrdinalIgnoreCase))
{
tabControlMain.TabPages.RemoveAt(i);
break;
}
}
but this is not what I'm looking for as I do not know the strings of the tabs I want to remove. I only know the names of two.