如何更改选项卡页面中的选项卡控件选择按钮单击事件的索引值? [英] How to change tab control in tab pages select index values on button click event ?

查看:80
本文介绍了如何更改选项卡页面中的选项卡控件选择按钮单击事件的索引值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有动态标签控件,我创建了动态5标签页。我可以按顺序更改按钮点击事件的标签页。例如(如果按钮单击它,我会有一个按钮,它将转到标签页2)请帮助我

解决方案

As 上面提到的Wes Aday 尝试这个,



  .tabControl1.SelectedTab = tabControl1.TabPages [ 1 ]; 


如果我理解正确的话你已经动态创建了tabpages。那就是你不知道tabpage名称或索引,你想要的是当点击一个按钮时导航到下一个tabpage是不是它?



它应该是什么东西像这样



  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)
{
// 如果最后一个标签是当前标签,则按钮点击应该导航到第一页
this .tabControl1.SelectedTab = tabControl1.TabPages [ 0 ];
}





因为我没有vs这不是编译或测试过的代码只把它作为想法


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   

解决方案

As Wes Aday mentioned above try this,

this.tabControl1.SelectedTab = tabControl1.TabPages[1];


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

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


这篇关于如何更改选项卡页面中的选项卡控件选择按钮单击事件的索引值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆