2012-03-09 93 views
2

我想根據位於選項卡中的不同信息獲取報告。我如何知道如果選擇了一個選項卡?我尋找類似的東西:如何知道是否選擇了選項卡?

if(colorListTab.isSelected) 
{ 

} 

但沒有運氣!你們能幫我解決這個問題嗎?

enter image description here

回答

3

你可以使用ActiveTab屬性,例如(在ActiveTabChanged):

if(TabContainer1.ActiveTab.Equals(colorListTab)){ 

} 

或者您可以使用ActiveTabIndex

if(TabContainer1.ActiveTabIndex == 1){ //second tab 

} 

http://www.dotnetcurry.com/ShowArticle.aspx?ID=178

+0

偉大的答案感謝@Tim的屬性 – 2012-03-09 16:42:10

1

你正在尋找的屬性是 「ActiveTab」,實際TabContainer的(不是個別標籤)

if(colorListTabContainer.ActiveTab.TabIndex == 1) 
{ 
    //You only get here if the index of the active tab is 1 
} 
相關問題