Results 1 to 4 of 4

Thread: what TabPage has been selected?

  1. #1
    wowjen is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5
    Join Date
    Dec 2009
    Posts
    13
    Reputation
    62

    Question what TabPage has been selected?

    I have 2 TabPages (tp1, tp2) in a TabControl.
    I have a button outside the TabControl.
    When I click the button there should be a message box that identifies what TapPage is currently selected.

    I want to know how to check what TabPage has been selected when I click the button.

    Pls help... thanks! ^_^

  2. #2
    newguy's Avatar
    newguy is offline VB.NET Forum Idol
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Jun 2008
    Location
    Denver Co, USA
    Posts
    611
    Reputation
    269
    You can check the Selected tab's text like:
    Code:
    MessageBox.Show(TabControl1.SelectedTab.Text)
    Close Counts for Horseshoes, Handgranades, and Nuclear Missiles!

  3. #3
    wowjen is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5
    Join Date
    Dec 2009
    Posts
    13
    Reputation
    62

    Question

    hmm...

    What I really want to do is to use "if..else" in identifying the selected tab in the TabControl, but how can I code it?

    thanks for the reply! ^_^ I add some reputation for you.

  4. #4
    JuggaloBrotha's Avatar
    JuggaloBrotha is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2004
    Location
    Lansing, MI; USA
    Posts
    4,364
    Reputation
    978
    Code:
    If TabControl1.SelectedTab Is TabPage1 Then
      'It's the first one
    Else
      'It's the second one
    End If
    I don't know why you'd want to know that as you have the actual page to work with already with the SelectedTab property.
    Currently using: VS 2010 Ultimate on Win7 Ultimate x64.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking