Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How To Determine Which TabPage Was Clicked on the Tab Control

Posted on 2006-11-29
4
Medium Priority
?
288 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
[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
4 Comments
 
LVL 16

Assisted Solution

by:Hillwaaa
Hillwaaa earned 200 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 1800 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

609 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