what TabPage has been selected?

wowjen

Member
Joined
Dec 27, 2009
Messages
13
Programming Experience
Beginner
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.:confused:

Pls help... thanks! ^_^ :)
 
You can check the Selected tab's text like:
VB.NET:
MessageBox.Show(TabControl1.SelectedTab.Text)
 
hmm...:cool:

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?:confused:

thanks for the reply! ^_^ I add some reputation for you.
 
VB.NET:
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.
 
Back
Top