Disable individual TabPages in a TabControl?
<p>I have a tabControl in my vb.net application - that has 3 tabs. Upon a click on the first tab I'm trying to do something so that user will not be able to get out of that tab - which seems to be a lot more difficult that I anticipated. I'm simply trying to disable the TAB itself - so that they are unable to leave the current tab - the TABPAGE does not have to be disabled since they are not supposed to be able to get out of the current one...</p>

<p>i'm trying something along the way of....</p>

<pre><code>tabControl1.tabPage(1).enabled=false
</code></pre>

<p>and</p>

<pre><code>tabcontrol1.tabpage1.enabled=false
</code></pre>

<p>and even trying to hide it</p>

<pre><code>tabcontrol1.tabpage(1).visible=false
</code></pre>

<p>And nothing seems to work.........!</p>

<p>i've even tried </p>

<pre><code>tabPage1.hide()
</code></pre>

<p>But doesn't do anything</p>

<p>EDIT: </p>

<p>I found this code - will I have to do something with this in order to disable the actual TAB - Not TAB PAGE - I don't want user leaving the tab they've on when they click a specific button...</p>

<pre><code>   Private Sub TabControl1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles TabControl1.DrawItem

    Dim g As Graphics
    Dim sText As String
    Dim iX As Integer
    Dim iY As Integer
    Dim sizeText As SizeF
    Dim ctlTab As TabControl
    ctlTab = CType(sender, TabControl)
    g = e.Graphics

    sText = ctlTab.TabPages(e.Index).Text

    sizeText = g.MeasureString(sText, ctlTab.Font)

    iX = e.Bounds.Left + 6

    iY = e.Bounds.Top + (e.Bounds.Height - sizeText.Height) / 2

    g.DrawString(sText, ctlTab.Font, Brushes.Black, iX, iY)

End Sub
</code></pre>

<p>Found this here...<a href="http://www.dreamincode.net/forums/topic/125792-how-to-make-vertical-tabs/" rel="nofollow noreferrer">http://www.dreamincode.net/forums/topic/125792-how-to-make-vertical-tabs/</a></p>