gpt4 book ai didi

c# - 使用代码切换到 TabControl 中的选项卡

转载 作者:太空宇宙 更新时间:2023-11-03 19:51:27 24 4
gpt4 key购买 nike

我的应用程序中有一个选项卡控件,其中有多个选项卡。

我想在按下“下一步”按钮时自动切换到另一个选项卡。

我不知道如何以编程方式更改哪个选项卡可见。

    private void Next_Click(object sender, EventArgs e)
{
// Change to the next tab
tabControl1.???;
}

最佳答案

使用 TabControl.SelectedTab 属性。 MSDN .

tabControl1.SelectedTab = anotherTab;

但您也可以使用 TabControl.SelectedIndex 属性。 MSDN .

try
{
tabControl1.SelectedIndex += 1;
}
catch
{
//This prevents the ArgumentOutOfRangeException.
}

关于c# - 使用代码切换到 TabControl 中的选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38734020/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com