which tab

  • Thread starter Thread starter Bill H.
  • Start date Start date
B

Bill H.

Is there a way to know which tab of a multi-tab form you are currently on?

I wish to take an action based on which tab I'm currently on.

thx.
 
Examine the Value of the tab control.

Compare it to the OptionValue of each Page until you have a match.
 
Allen Browne said:
Examine the Value of the tab control.

Compare it to the OptionValue of each Page until you have a match.

I think it's the PageIndex property, not the OptionValue property, that
you want to compare to.
 
I don't fully understand.

what do you mean by "compare until I have a match?" and how do deal with the
user moving from tab to tab and back again. Like, when tab index=0 do this,
else do that.

--Bill
 
Bill said:
I don't fully understand.

what do you mean by "compare until I have a match?" and how do deal
with the user moving from tab to tab and back again. Like, when tab
index=0 do this, else do that.

--Bill

If you have four TabPages they have a TabIndex value of 0, 1, 2, and 3
respectively. The entire TabControl takes on the vlaue of the TabIndex of
the currently selected page. So in the Change event of the TabControl you
have code like...

Select Case Me.TabControlName.Value
Case 0
'page one is selected
Case 1
'page two is selected
Case 2
'page three is selected
Case 3
'page four is selected
End Select
 
If you know the page you are after has PageIndex 3, you can simply do:
If Me.Tab1 = 3 Then ...

However, if you rearrange the pages or insert others, that code will break.
For maintenance purposes you might therefore want to code:
If Me.Tab1 = Me.pge3.PageIndex Then ...
 
the other question is, where do you put this code so that it's always
running?

thus whenever the user clicks on tab 3, the code runs and likewise when he's
not on tab3 an "else" code can run.

what I'm trying to do is whenever tab index 0 is active, to hide the
navigation buttons and unhide (show) them whenever the user is on any other
tab. And the form opens on tab index 0.

--Bill
 
this will seem stupid, but when I click on a tab (in design mode) and then
look at the event options, there is NO "on change" event.

All I see is on click, on dbl click, mouse down, mouse move, and mouse up.
:-(

Where is th tab control change event?
 
Bill said:
this will seem stupid, but when I click on a tab (in design mode) and
then look at the event options, there is NO "on change" event.

All I see is on click, on dbl click, mouse down, mouse move, and
mouse up. :-(

Where is th tab control change event?

You have to have the entire TabControl selected rather than one of the pages.
 
Back
Top