Solved

How To Determine Which TabPage Was Clicked on the Tab Control

Posted on 2006-11-29
4
256 Views
Last Modified: 2012-05-05
Hi,

I'm using VS.NET 2005.  When the user makes a selection from the tab control, I would like to load a combo box with specific data based on which tab page was clicked.  How do I create a tab control click event to identify which tab page was selected?

Thanks,
Denise
0
Comment
Question by:DeniseGoodheart
  • 2
4 Comments
 
LVL 16

Assisted Solution

by:Hillwaaa
Hillwaaa earned 50 total points
ID: 18041942
Hi DeniseGoodheart,

You could use something like this (note you'll have to add multiple TabPageX.Click subs):

    Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
        Me.loadComboBoxVals("TabPage1")
    End Sub

    Private Sub loadComboBoxVals(ByRef page As String)
        If (page = "TabPage1") Then
            ... load combobox values here for page 1
        ElseIf (page = "TabPage2") Then
            ... load combobox values here for page 2
        End If
    End Sub

Cheers,
Hillwaaa
0
 
LVL 39

Accepted Solution

by:
appari earned 450 total points
ID: 18041945
try like this

Private Sub tabcontrol1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles tabcontrol1.SelectedIndexChanged
        Try
            If Me.tabcontrol1.SelectedTab.Equals(Me.tabPage1) = True Then
            msgbox("Tab page1 selected")
            Else
            msgbox("Other Tab page selected")
            End If

        Catch ex As Exception
           
        Finally
           
        End Try
    End Sub
0
 
LVL 16

Expert Comment

by:Hillwaaa
ID: 18041997
Ah yes - my solution uses the wrong event - use the tabcontrol.SelectedIndexChanged as appari says.  You can still pass things out to a sub to load the combobox values if you want to keep things neat, but that's up to you :)
0
 

Author Comment

by:DeniseGoodheart
ID: 18046895
Thanks all for the great help!  I love Experts-Exchange!

Cheers,
Denise
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

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…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

831 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