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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB 2008 :: Identify TabPage Selected

Status
Not open for further replies.

RileyCat

Programmer
Apr 5, 2004
124
0
0
US
How can I easily identify the TabPage that is selected or currently front on a TabControl?

Stay Cool Ya'll! [smile2]

-- Kristin
 
FYI . . . I am currently doing this but it doesn't like the check for the tab name in the case statement . . .

<code>
Private Sub tabNmsXRef_Selected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TabControlEventArgs) Handles tabNmsXRef.Selected

Dim ThisPage As TabPage = tabNmsXRef.SelectedTab

Select Case ThisPage
Case ThisPage.Name.Equals("tabMfrXRefAdd")




End Select

End Sub
</code>

The error the "case" line is giving is . . .

"Operator '=' is not defined for types 'TabPage' and 'Boolean'.

Any help is appreciated.

Thanks.


Stay Cool Ya'll! [smile2]

-- Kristin
 
If you want to find out which tab gets selected, you can use the Selected event of the tab control and investigate the TabPageIndex of the TabControlEventArgs passed to the event.

If you just want to know which page is currently selected you can use the SelectedIndex property of the TabControl.

Hope this helps

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Never mind . . . Got it to work like this . . .

Private Sub tabNmsXRef_Selected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TabControlEventArgs) Handles tabNmsXRef.Selected

Dim ThisPage As TabPage = tabNmsXRef.SelectedTab

Select Case True
Case ThisPage.Name.Equals("tabMfrXRefAdd")




End Select

End Sub


Stay Cool Ya'll! [smile2]

-- Kristin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top