How would I implement "close all other tabs" function for a tab control using Context menu strip?
+1
A:
I made a small app with just one tabcontrol in the main window and a context menu connected to that tabcontrol.
The following is the handler for the context menu item:
private void closeAllOtherToolStripMenuItem_Click(object sender, EventArgs e)
{
for (int i = 0; i < this.tabControl1.TabCount; i++)
if (i != tabControl1.SelectedIndex)
tabControl1.TabPages.RemoveAt(i--);
}
Guge
2008-11-19 07:42:03
A:
What Exactly do you mean by "close"? Do you mean make the tab page invisible, disabled, etc.?
Ed Swangren
2008-11-19 07:48:45