Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have 2 tab (tab page1, tab page2)in a single tab control and i have 2 buttons.i want to open tab page1 on button1 click, and open tab page2 on button2 click.
but condition is that when user click button1 then tab page2 should not be display and when user click button2 then tab page1 should not be display. plz help me as soon as possible
thank you!
Posted
Comments
BillWoodruff 1-Nov-13 0:51am    
Hiding a TabPage by removing it from the TabControl, and showing it by adding it back to the TabControl ... which, as OriginalGriff points out below, is the only way to you can hide a TabPage ... is generally a bad design decision. Why use a TabControl if you are going to do this ?

Set the Active tab, using the TabControl.SelectedTab Property[^], but to "hide" a TabPage you have to remove it from the TabControl.TabPages list.
 
Share this answer
 
Hi,
Try the following code in your click events,

C#
button1_Click() 
{
 tabpage1.Visible = true;
 tabpage2.Visible = false;
}

button2_Click() 
{
 tabpage2.Visible = true;
 tabpage1.Visible = false;
}


Regards,
BlueSathish
 
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