Tab Control

  • Thread starter Thread starter PeterM
  • Start date Start date
P

PeterM

This is driving me crazy. I have a tab control with 5
tabs (pages) on it. On each page is an ActiveX Web
Browser object called ActiveXCtl00 through ActiveXCtl04.
I need to determine which tab is active, in focus,
visible, etc. or which Web Browser object is active,
infocus, visible, etc.

I get an invalid reference message when I try any of the
following...

If Me.TabControl.Pages(0).IsVisible then....

If Me.TabControl.Pages("Tab Name").IsVisible then....

If Me.TabControl.Pages.Index(0).IsVisible then....

If Me.ActiveXCtl00.IsVisible then....

what am I doing wrong?
 
Where tabMain is the name of a TabControl:

Me.tabMain.Pages(Me.tabMain).Value = the PageIndex # of the active/current
tab
Me.tabMain.Pages(Me.tabMain).Name = the name of the active tab

I'd suggest using a Select Case statement rather than using an If...Then
statement based on Visible

Select Case Me.tabMain.Pages(Me.tabMain).Name
Case "Tab One"
' Do this if Tab One is the current tab

Case "Tab Two"
' Do this if Tab Two is the current tab

etc...
End Select

Hope this helps,
 
Back
Top