Cycle through some tab contols...

Hello experts,

Part of my interface works by hiding various tabs depending on a user selection.

I've written the following pseudo-code, but i cant find the necessary syntax to actually make it work in VB.net.
Tabs_FrmMain is a standard tab control.

Sub SelectTabPage(ByVal intPage As Integer)
        If (intPage >= 0 And intPage < Me.Tabs_FrmMain.TabCount()) Then 'tab is in range
            Dim x As Integer
            For x = 0 To Me.Tabs_FrmMain.TabCount() Step 1            
                Me.Tabs_FrmMain.TabPage[x].Visible = False
            Next
            Me.Tabs_FrmMain.TabPage[intPage].Visible = True
        Else 'invalid tab selected
        End If
End Sub


any takes?
mnamiriAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
LacutahConnect With a Mentor Commented:
Funny you should ask, I answered this one a few days ago...  Essentially you can't "show" and "hide" tabs inside a tab control (don't know why, but you can't)  However, you can remove them from the tab pages collection and re-add them back later.

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21369098.html
0
 
mnamiriAuthor Commented:
Lacutah,

you said the following in your previous answer... (unfortunately my VB skills still arn't up to speed), but how do you create the array with the tab pages copied into it. etc. i guess what im searching for is a bit or a turn-key solution.



<---SNIP--->
I've run into this too.  TabControls contain TabPages.  The trick is to remove the pages in question, and add them back into the TabControl if needed.

For example:
Private MyHiddenPages as New ArrayList()
Sub From1_Load(...)
      if IsGuesUser then
          'Add page to ArrayList object, so can restore later..
           MyHiddenPages.Add(MyTabControl.TabPages(0))
          'Remove page from tabcontrol
           MyTabControl.TabPages.RemoveAt(0)
      end if
End Sub
0
All Courses

From novice to tech pro — start learning today.