Solved

Syntax for TabControl

Posted on 2010-11-21
2
396 Views
Last Modified: 2012-05-10
Hi. I am working with a TabControl that has three tabs.  I need the syntax to determiine what tab page the user is on.   Here are the names of the controls that I'm using:

tabWebBook - name of the tab control
tabPageWebSites - name of tab page 1
tabPageCreditCards - name of tab page 2
tabPageSettings - name of tab page 3

I am working on a Case statement and need the correct syntax for the following:
select case tabWebBook.tabPageWebSites
                  ' do something
           case tabWebBook.tabPageCreditCards
                   ' do something
           case tabWebBook.tabPageSettings
                   ' do something
end select

Thanks!
0
Comment
Question by:Agent909
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
Shane32EE earned 500 total points
ID: 34184515
When using the If statement, it would look like this:

If tabWebBook.SelectedTab Is tabPageWebSites Then
 ' do something
ElseIf tabWebBook.SelectedTab Is tabPageCreditCards Then
 ' do something
ElseIf tabWebBook.SelectedTab Is tabPageSettings Then
 ' do something
End If

The Select Case statement does not support the Is comparison.  But you can use the SelectedIndex property like this:

Select Case tabWebBook.SelectedIndex
  Case 0 'first tab (tabPageWebSites)
    'do something
  Case 1 'second tab (tabPageCreditCards)
    'do something
  Case 2 'third tab (tabPageSettings)
    'do something else
End Select
0
 
LVL 1

Author Closing Comment

by:Agent909
ID: 34184533
I tested it, and it works great!  Thank you.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question