Hack Forums
[.NET] Disable Certain Tabs from TabControl - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Disable Certain Tabs from TabControl (/showthread.php?tid=5544376)



Disable Certain Tabs from TabControl - Prillor - Feb 6, 2017

Before people tell me to go to google, I have already searched a few pages from google in regards to my question.

This isn't a case of "TabPage1.Enabled = False" as that only disables the contents in the page.

Basically, I am creating a Password Management program for personal use, and I have the TabControl created by Mavamartin (if that is how his name is spelt) basically, this is what it looks like;

i.imgur [.] com/N4VxfRW.png

And I am wanting to disable the tabs in-between Settings & About.

As you can see I have a blank tab selected, but want to disable 5,6,7,8(which is in between the two).

I have tried;

Code
For Each tab In DotNetBarTabcontrol1.TabPages
        If tab.Text =""
            tab.Enabled =False
        End If
    Next
,

And quiet a few other methods I saw online but none are working.

If someone know's how this could be possible (IF) would you mind giving a hand?

Thanks.

(Sorry for image link, I have below 50 post's)


* - Narwin - Feb 6, 2017

Maybe remove will be the best option.


* - Naywyn - Feb 6, 2017

You may want to look at the Selecting event for that:

PHP Code

<?php 
Private Sub TabControl1_Selecting(sender as Object, e as TabControlCancelEventArgs) Handles TabControl1.Selecting
    
If TabControl1.SelectedTab Is Settings Then
       
' Cancel Selection (tab cannot be selected)
       e.Handled = True
    End If
End Sub 



* - Ninja - Feb 6, 2017

Don't individual tabs have a Visible property or am I just making this up?


* - Prillor - Feb 6, 2017

(Feb 6, 2017 10:20 AM)Ninja Wrote:  Don't individual tabs have a Visible property or am I just making this up?

Being a custom tab control this one doesn't have a visible property.


(Feb 6, 2017 10:05 AM)Naywyn Wrote:  You may want to look at the Selecting event for that:

PHP Code

<?php 
Private Sub TabControl1_Selecting(sender as Object, e as TabControlCancelEventArgs) Handles TabControl1.Selecting
    
If TabControl1.SelectedTab Is Settings Then
       
' Cancel Selection (tab cannot be selected)
       e.Handled = True
    End If
End Sub 

Will give it a shot mate, and post back. Thank you for your help. :)