如何基于选项卡页面标签值选择一个选项卡

发布于 2025-02-02 14:24:50 字数 955 浏览 4 评论 0原文

我有一个SyncFusion选项卡控件,并且根据用户的帐户数量填充它们的选项卡。

foreach (SecurityAccount securityAccount in secs)
{
    string name = securityAccount.AccountNumber;

    Syncfusion.Windows.Forms.Tools.TabPageAdv tabPage = 
             new Syncfusion.Windows.Forms.Tools.TabPageAdv(securityAccount.PortfolioName 
                             + " [" + securityAccount.AccountNumber + "]");

    tabPage.Tag = securityAccount.AccountNumber;
    tcAcc.TabPages.Add(tabPage);

    if (securityAccount.IsDefaultPortfolio)
        defaultPortfolioName = securityAccount.AccountNumber;
}

在每个安全帐户中,都有一个名为isDefaultPortFolio帐户的字段或一个字段。 因此,如果是默认值,我将该值放在DefaultPortFolioname参数中 因此,现在我想选择具有此安全帐户号的TABPAGE(将其放入TabPage.tag值中。

我写了这本书,

tcAcc.SelectedIndex = tcAcc.TabPages.IndexOf(defaultPortfolioName);

但这无效,因为我不是说要检查每个选项卡的标签值。

I have a syncfusion tab control and their Tabs are populated according to the number of accounts a user has.

foreach (SecurityAccount securityAccount in secs)
{
    string name = securityAccount.AccountNumber;

    Syncfusion.Windows.Forms.Tools.TabPageAdv tabPage = 
             new Syncfusion.Windows.Forms.Tools.TabPageAdv(securityAccount.PortfolioName 
                             + " [" + securityAccount.AccountNumber + "]");

    tabPage.Tag = securityAccount.AccountNumber;
    tcAcc.TabPages.Add(tabPage);

    if (securityAccount.IsDefaultPortfolio)
        defaultPortfolioName = securityAccount.AccountNumber;
}

In every security account, there is a field called IsDefaultPortfolio Account or a not.
so if it is a default one I am putting that value in the defaultPortfolioName parameter
So now I want to select the tabpage that has this security account number (Which is put into tabPage.Tag value.

I wrote this

tcAcc.SelectedIndex = tcAcc.TabPages.IndexOf(defaultPortfolioName);

But that doesn't work because I am not saying to check the Tag value of each tab.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

厌味 2025-02-09 14:24:50

根据每个卡普普的标签中存储的值选择选项卡。

foreach(TabPageAdv page in tabControlAdv1.TabPages)
{
   if(defaultPortfolioName==(int)page.Tag)
    {
       tabControlAdv1.SelectedIndex = tabControlAdv1.TabPages.IndexOf(page);
        break;
     }
}

Select the tabpage based on the value stored in the tag of each tabpage.

foreach(TabPageAdv page in tabControlAdv1.TabPages)
{
   if(defaultPortfolioName==(int)page.Tag)
    {
       tabControlAdv1.SelectedIndex = tabControlAdv1.TabPages.IndexOf(page);
        break;
     }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文