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

TabControl1.Controls.Remove(TabControl1.SelectedTab)

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

-Doc

Recommended Answers

All 2 Replies

Member Avatar for Unhnd_Exception

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
      TabControl1.Controls.Remove(TabControl1.SelectedTab)
 End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.