Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to determine which tab is currently selected? 2

Status
Not open for further replies.

CGSB

Programmer
May 23, 2006
35
CA
I would like to know how I can determine the currently selected tab so that I can call different functions based on the tab the user is on.

Please help.
 
Hi, CGSB,

The .Value property of the tab control is equal to the index of the currently selected tab page (starting from zero). So, for example, the following snippet of code behind a command button will reveal the currently selected tab page:
Code:
Dim iMyInt As Integer
Dim strMyString As String

iMyInt = Me!TabCtl0.Value

strMyString = Me!TabCtl0.Pages(iMyInt).Caption

MsgBox strMyString & " is the currently selected tab page."
HTH,

Ken S.
 
How are ya CGSB . . .

1st . . . in parallel with [blue]Eupher[/blue] . . . the [blue]Value[/blue] property is implicit/implied for most controls. So that:
Code:
[blue]   intVariable = Me!TabCtlName.[purple][b]Value[/b][/purple]
is the same as:
   intVariable = Me!TabCtlName[/blue]
As the programmer this should suffice for what tab your on. But if you want to ping on the actual text in the tab, you'd perform the following:
Code:
[blue]   strVariable = Me!tabCtlName.Pages(Me!tabCtlName).Name[/blue]
I hope you see the jist of it all! . . .

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top