So i have several tabs, and i close them all using a button with:


But I have been trying to figure out how to make sure the main tab doesnt close.
What can i do to make sure the main tab can't shut down, when closing tabs with the above code?

Thanks in advance


Member Avatar

Just check that the selected tab page doesn't equal a tab page you don't want to remove.

I named a tab page - tbpgMain. This will ensure it can't be removed.

If Not TabControl1.SelectedTab.Equals(tbpgMain) Then
 End If