Solved

Syntax for TabControl

Posted on 2010-11-21
2
393 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

867 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now