如何在按钮上单击c sharp打开相应的选项卡

问题描述:

我在一个标签控件中有2个标签(标签页1,标签页2),我有2个按钮。我想在按钮1点击打开标签页1,然后在按钮2点击打开标签页2.

但条件是,当用户单击button1时,不应显示tab page2,当用户单击button2时,不应显示tab page1。 PLZ尽快帮助我

谢谢!

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!

使用TabControl.SelectedTab Property [ ^ ] ,但要隐藏一个TabPage,你必须从TabControl.TabPages列表中删除它。
Set the Active tab, using the TabControl.SelectedTab Property[^], but to "hide" a TabPage you have to remove it from the TabControl.TabPages list.




在点击事件中尝试以下代码,



Hi,
Try the following code in your click events,

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

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





问候,

BlueSathish



Regards,
BlueSathish