Click here to Skip to main content
15,894,242 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have dynamic tab control and i created dynamic 5 tab pages.how can i sequence to change tab pages on button click event. Eg(tab page in i have one button if button click it will go to tab page2) please help me   
Posted
Comments
[no name] 20-Jul-14 9:15am    
Help you with what? Set the SelectedTab property on your tab control.

As Wes Aday mentioned above try this,

C#
this.tabControl1.SelectedTab = tabControl1.TabPages[1];
 
Share this answer
 
if I understood you correctly you had created tabpages dynamically. that is you are not aware of tabpage name or indexes and what you want is to navigate to next tabpage when a button is clicked is nt it?

it should be something like this

C#
int tabCount = tabControl1.TabPages.Count;

int currentindex = int.parse (tabcontrolname.GetActiveTabIndex().tostring());

if(tabCount >currentindex )
{
this.tabControl1.SelectedTab = tabControl1.TabPages[currentindex +1];
}
else if (tabCount =currentindex )
{
// if last tab is the current tab then button click should navigate to the first page 
this.tabControl1.SelectedTab = tabControl1.TabPages[0];
}


since I don't have vs this is not compiled or tested code take this as idea only
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900